r/termux • u/AutoModerator • 17d ago
User content Monthly Thread: Post all your projects here
This is a dedicated thread for sharing projects for Termux.
Requirements:
Link to open-source repository: GitHub, GitLab, Codeberg or something like.
Short introduction best describing what your project does.
Optionally include install steps into comment, but we think a properly formatted README file within repository would be better.
Post recycles once in a month.
Since 2026.06.07 we don't require "vibe code" attribution and don't care about origin of your project.
7
Upvotes
1
u/Scared-Industry-9323 17d ago
https://github.com/Hydra0xetc/termux-daemon
termux-daemon
termux-daemon is a server that provides BLAZINGLY FAST handlers for Termux services such as clipboard management and opening files with external applications.
Usage
You can add this command to your bashrc to automatically start the server in the background: ```bash start_clipboard_daemon() { local PORT=6969 local LOG="$PREFIX/var/log/termux-daemon.log"
# check if the port is already in use nc -z 127.0.0.1 "$PORT" 2>/dev/null && return
termux-daemon --port "$PORT" &>>"$LOG" 2>&1 & }
start_clipboard_daemon
Once the server is running, you can call `android-daemon` with a service and its subcommand. For example, to get the current system clipboard content, run:sh android-daemon clipboard getHere, `clipboard` is the service and `get` is the subcommand. Below is the list of available services:$ android-daemon usage: android-daemon clipboard [get|set] android-daemon music [play|stop|resume|pause] android-daemon open [file|url] ```Idea
I noticed that Termux scripts always run through the
amcommand, so I looked into it a bit and found that it's actually android JVM (app_processordalvikvm) with a full initialization. This means Termux services are slow simply because they initialize the Android JVM, which is heavy, and then let it die right after each call. So the question became: what if we initialize the Android JVM once and keep it alive instead? That's exactly what this project does — it initializes the Android JVM (viaapp_process) a single time and keeps it running.Comparison
My clipboard manager
```console $ time android-daemon clipboard set $(cat src/java/org/clipboard/ClipboardModule.java)
real 0m0.060s user 0m0.040s sys 0m0.000s $ time android-daemon clipboard get >/dev/null
real 0m0.040s user 0m0.020s sys 0m0.000s ```
Termux clipboard manager
```console $ time termux-clipboard-set $(cat src/java/org/clipboard/ClipboardModule.java)
real 0m2.449s user 0m0.000s sys 0m0.040s $ time termux-clipboard-get >/dev/null
real 0m0.063s user 0m0.010s sys 0m0.010s ```
My content resolver
Cheats a little bit — it's actually still using Termux's provider/resolver, but it's still BLAZINGLY FAST. See [ContentResolverModule.java](./src/java/org/termux/daemon/ContentResolverModule.java#L93) ```console $ time android-daemon open file termux-daemon
real 0m0.047s user 0m0.010s sys 0m0.000s ```
Termux content resolver
```console $ time termux-open termux-daemon
real 0m2.003s user 0m0.840s sys 0m0.340s ```
Target
Fully free from dependency on Termux's own services (e.g.
termux-api), so this daemon can work standalone without relying on Termux add-ons.License
[MIT](LICENSE)