[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
1 changed files with 15 additions and 11 deletions

View File

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