add charge status indication
This commit is contained in:
12
bin/st-power
12
bin/st-power
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user