feat: better handle 2 batteries

This commit is contained in:
David JULIEN 2021-09-09 22:18:20 +02:00
parent 0aa8c15431
commit bf8804a467

View File

@ -37,10 +37,12 @@ do
status="$(cat "$bat/status")"
capacity="$(cat "$bat/capacity")"
total="$(expr $total + $capacity)"
slot="$(basename $bat)"
if [ "$status" = "Full" ]; then
status=" " && capacity="FULL"
printf " %s %s " "$status" "$capacity" && exit
elif [ "$status" = "Charging" ]; then
printf " %s:%s(%s) " "$slot" "$status" "$capacity"
else
if [ "$status" = "Charging" ]; then
status=""
else
case "$capacity" in
@ -52,5 +54,6 @@ do
esac
fi
[ 40 -gt $total ] && notify;
printf " %s %3d%% " "$status" "$capacity";
printf " %s:%s (%0.2d%%) " "$slot" "$status" "$capacity";
fi
done