PinePhoneBoyOS/usr/local/bin/waybar_battery
2021-01-09 14:49:15 +01:00

16 lines
317 B
Bash
Executable File

#!/bin/bash
READBAT="cat /sys/class/power_supply/axp20x-battery/uevent"
GETVAL="cut -d= -f2"
LOWERCASE="tr '[:upper:]' '[:lower:]'"
STATUS=`$READBAT | grep STATUS | $GETVAL | $LOWERCASE`
CHARGE=`$READBAT | grep CAPACITY | $GETVAL`
TEXT="$CHARGE%"
CLASS=$STATUS
echo {\"text\": \"$TEXT\", \"class\": \"$CLASS\"}