Eniggman/termux-lab / termux-api
termux-api
VerifiedВзаимодействие с Android OS и аппаратными датчиками смартфона через Termux:API (батарея, уведомления, буфер обмена, вибрация, диалоги, сенсоры, TTS).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.6 KB |
| scripts/battery_check.shexecutable | script | 1.4 KB |
| scripts/clipboard.shexecutable | script | 1.0 KB |
| scripts/dialog.shexecutable | script | 852 B |
| scripts/notify.shexecutable | script | 882 B |
| scripts/sensor_read.shexecutable | script | 690 B |
| scripts/toast.shexecutable | script | 620 B |
| scripts/tts_speak.shexecutable | script | 575 B |
| scripts/vibrate.shexecutable | script | 558 B |
scripts/battery_check.sh
View on GitHub#!/data/data/com.termux/files/usr/bin/bash
# ==============================================================================
# battery_check.sh - Query Android battery status via Termux:API
# Part of Enigman Termux Lab (https://github.com/Enigman-Termux-lab)
# ==============================================================================
set -euo pipefail
if ! command -v termux-battery-status >/dev/null 2>&1; then
echo "ERROR: termux-battery-status not found. Install via 'pkg install termux-api'." >&2
exit 1
fi
RAW_STATUS="$(termux-battery-status 2>/dev/null || true)"
if [ -z "$RAW_STATUS" ]; then
echo "ERROR: Failed to retrieve battery status from Termux:API companion app." >&2
exit 2
fi
if [ "${1:-}" = "--json" ]; then
echo "$RAW_STATUS"
exit 0
fi
# Parse key fields using python fallback or raw json
if command -v python >/dev/null 2>&1; then
read -r PERCENT STATUS HEALTH TEMP PLUGGED <<< "$(echo "$RAW_STATUS" | python -c '
import sys, json
data = json.load(sys.stdin)
print(f"{data.get(\"percentage\",\"?\")} {data.get(\"status\",\"?\")} {data.get(\"health\",\"?\")} {data.get(\"temperature\",\"?\")} {data.get(\"plugged\",\"UNPLUGGED\")}")
')"
echo "🔋 Battery Status:"
echo " Level: ${PERCENT}%"
echo " State: ${STATUS} (${PLUGGED})"
echo " Health: ${HEALTH}"
echo " Temperature: ${TEMP}°C"
else
echo "$RAW_STATUS"
fi
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |