mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-20 05:23:20 -07:00
Merge pull request #49 from kalsi-avneet/master
Add support for battery status indicator on termux
This commit is contained in:
commit
ef4b29db40
1 changed files with 7 additions and 0 deletions
|
@ -100,6 +100,13 @@ __battery() {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
# Android Termux support
|
||||||
|
if eval $BYOBU_TEST termux-battery-status -h >/dev/null 2>&1; then
|
||||||
|
BATTERY_STATUS=$(termux-battery-status)
|
||||||
|
full=100
|
||||||
|
rem=$(printf "%s" "$BATTERY_STATUS" | awk '/percentage/ { gsub(/[,]/,""); print $2}')
|
||||||
|
state=$(printf "%s" "$BATTERY_STATUS" | awk '/status/ { gsub(/[",]/,""); print $2}')
|
||||||
|
fi
|
||||||
if [ $rem -ge 0 ] && [ $full -gt 0 ]; then
|
if [ $rem -ge 0 ] && [ $full -gt 0 ]; then
|
||||||
percent=$(((100*$rem)/$full))
|
percent=$(((100*$rem)/$full))
|
||||||
if [ "$percent" -lt 33 ]; then
|
if [ "$percent" -lt 33 ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue