add charge status indication

This commit is contained in:
2026-03-29 15:19:14 -10:00
parent 081dbdedc1
commit fd6cac971f

View File

@@ -38,7 +38,17 @@ else
POWER="$(echo "scale=2; $VOLTAGE*$CURRENT/1000000000000" | bc)W"
fi
STATUS=$(cat /sys/class/power_supply/BAT*/status)
case "$STATUS" in
"Charging")
STATUS="+";;
"Discharging")
STATUS="-";;
"Not Charging")
STATUS="...";;
esac
CHARGE="$(cat /sys/class/power_supply/BAT*/capacity)%"
echo "$CHARGE $POWER"
echo "$CHARGE $STATUS$POWER"