Skip to content

Commit 8da2211

Browse files
gordolmartinbeentjes
authored andcommitted
termux initial support (#61)
1 parent 267d960 commit 8da2211

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

scripts/battery_percentage.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ print_battery_percentage() {
2222
fi
2323
elif command_exists "acpi"; then
2424
acpi -b | grep -m 1 -Eo "[0-9]+%"
25+
elif command_exists "termux-battery-status"; then
26+
termux-battery-status | jq -r '.percentage' | awk '{printf("%d%%", $1)}'
2527
fi
2628
}
2729

scripts/helpers.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@ battery_status() {
3636
upower -i $battery | awk '/state/ {print $2}'
3737
elif command_exists "acpi"; then
3838
acpi -b | awk '{gsub(/,/, ""); print tolower($3); exit}'
39+
elif command_exists "termux-battery-status"; then
40+
termux-battery-status | jq -r '.status' | awk '{printf("%s%", tolower($1))}'
3941
fi
4042
}

0 commit comments

Comments
 (0)