Tools — overview¶
Headless Lab has 7 commands covering four areas: app management, memory, hardware (screen and touch), and observability. All follow the same safety patterns.
Quick map¶
| Command | Area | Language | One-liner |
|---|---|---|---|
appctl |
Apps | Python | TUI to disable/enable apps, profiles, backups and SystemUI/launcher/keyboard repair |
createswap |
Memory | Python | Manage ZRAM + swapfile with panel, dry-run, rollback and boot hook |
battery |
Hardware | Python | Battery monitor: level, temp, health, cycles, current, live mode |
touch-ctl |
Hardware | Bash | Reversibly disable/enable touchscreen via mknod + sysfs |
screen-state |
Hardware | Bash | Report screen on/off (exit code for scripts) |
screen-toggle |
Hardware | Bash | Turn screen on/off/toggle using KEYCODE_WAKEUP/SLEEP |
user-list |
Observability | Python | UID → packages → processes → RAM map, with filters and JSON |
Common patterns¶
Automatic root elevation¶
All tools try, in this order:
- run directly if already root (
id -u == 0); su -c(Magisk);sudo.
You do not need to type sudo. If all fail, the tool prints the exact
reason of each attempt (e.g. su: denied; sudo: not found) and what to do
(Open Magisk > Superuser and grant access to Termux).
--dry-run / -n¶
Simulate before applying. Available in appctl (profiles and --disable) and
createswap (any --setup-*). Output shows exactly what would change.
--json¶
Structured output for scripts. Available in battery, user-list, and in
createswap (for the status panel). See Automation for
ready-made recipes.
Exit codes¶
Almost all follow this convention:
| Code | Meaning |
|---|---|
0 |
success |
1 |
operational failure (couldn't fulfill the request) |
2 |
couldn't read state / no root where needed |
3 |
no root (touch-ctl) |
4 |
hardware not found (touch-ctl) |
64 |
invalid usage (bad argument) |
Use in scripts:
Reversibility¶
appctlusespm disable-user/pm enable— never uninstalls.createswaprolls back each step if a later one fails.touch-ctlself-restores ifofffails after removing the device node.screen-togglere-reads state and confirms the change (idempotent).
Which to use first?¶
- First time on a device:
createswap --statusto see RAM, thenappctl --profilesto understand profiles. - Production server:
appctl --profile servidor-seguro, thencreateswap --setup-zram 1G --install-boot. - Cracked screen with ghost touch:
touch-ctl off(after ensuring SSH access). - 24/7 monitoring:
battery --watch 5in atmux, or--jsonin an alert script.
Continue to each tool's page via the side menu.