Update battery capacity calculation
This commit is contained in:
parent
1ff340925f
commit
614346124a
|
@ -1,8 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
battery=/sys/class/power_supply/BAT0
|
battery=/sys/class/power_supply/BAT0
|
||||||
status=$(cat "$battery/status")
|
status=$(cat "$battery/status" 2>&1)
|
||||||
maxCapacity=85
|
|
||||||
|
|
||||||
#case "$(cat "$battery/status" 2>&1)" in
|
#case "$(cat "$battery/status" 2>&1)" in
|
||||||
case "$(cat "$battery/status" 2>&1)" in
|
case "$(cat "$battery/status" 2>&1)" in
|
||||||
|
@ -19,7 +18,8 @@ if [ "$status" = "Full" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
capacity="$(cat "$battery/capacity" 2>&1)"
|
chargeNow=$(cat "$battery/charge_now" 2>&1)
|
||||||
capacity=$(echo "$capacity/$maxCapacity*100" | bc -l)
|
chargeFull=$(cat "$battery/charge_full" 2>&1)
|
||||||
|
capacity=$(echo "$chargeNow/$chargeFull*100" | bc -l)
|
||||||
|
|
||||||
printf "%s %.0f%%" "$statusIcon" "$capacity"
|
printf "%s %.0f%%" "$statusIcon" "$capacity"
|
||||||
|
|
Loading…
Reference in New Issue