[statusbar] feat: handle >100% battery cases

This commit is contained in:
David JULIEN 2022-06-11 12:24:01 +02:00
parent 1bd3ea5adc
commit 72d94850b4

View File

@ -42,18 +42,22 @@ do
status=" " && capacity="FULL" status=" " && capacity="FULL"
printf " %s:%s(%s) " "$slot" "$status" "$capacity" printf " %s:%s(%s) " "$slot" "$status" "$capacity"
else else
if [ "$status" = "Charging" ]; then if [ 100 -lt $(expr $capacity) ]; then
status="" status=""
else else
case "$capacity" in if [ "$status" = "Charging" ]; then
100|[8-9][0-9]) status="" ;; status=""
[6-7][0-9]) status="" ;; else
[4-5][0-9]) status="" ;; case "$capacity" in
[2-3][0-9]) status="" ;; 100|[8-9][0-9]) status="" ;;
*) status="" ;; [6-7][0-9]) status="" ;;
esac [4-5][0-9]) status="" ;;
[ "BAT0" = $slot ] && [ 30 -gt $capacity ] && notify; [2-3][0-9]) status="" ;;
*) status="" ;;
esac
[ "BAT0" = $slot ] && [ 30 -gt $capacity ] && notify;
fi
printf " %s:%s (%0.2d%%) " "$slot" "$status" "$capacity";
fi fi
printf " %s:%s (%0.2d%%) " "$slot" "$status" "$capacity";
fi fi
done done