fix: switch statement on battery status
This commit is contained in:
parent
9d06a61780
commit
788e1a14eb
@ -26,17 +26,17 @@ for bat in /sys/class/power_supply/BAT?/
|
|||||||
do
|
do
|
||||||
status="$(cat "$bat/status")"
|
status="$(cat "$bat/status")"
|
||||||
capacity="$(cat "$bat/capacity")"
|
capacity="$(cat "$bat/capacity")"
|
||||||
if [ "$status" = "Charging" ]; then
|
if [ "$status" = "Full" ]; then
|
||||||
|
printf " FULL" && exit
|
||||||
|
elif [ "$status" = "Charging" ]; then
|
||||||
status=""
|
status=""
|
||||||
elif [ "$status" = "Full" ];
|
|
||||||
printf "%s FULL" "$status";
|
|
||||||
else
|
else
|
||||||
case "$capacity" in
|
case "$capacity" in
|
||||||
100|9[0-9]|8[0-9]) status="" ;;
|
100|9[0-9]|8[0-9]) status="" ;;
|
||||||
7[0-9]|6[0-9]) status="" ;;
|
7[0-9]|6[0-9]) status="" ;;
|
||||||
5[0-9]|4[0-9]) status="" ;;
|
5[0-9]|4[0-9]) status="" ;;
|
||||||
3[0-9]|2[0-9]) status="" ;;
|
3[0-9]|2[0-9]) status="" ;;
|
||||||
*) status="" ; [ "$status" != "Charging" ] && notify;;
|
*) status="" ; notify;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
printf "%s %3d%%\n" "$status" "$capacity";
|
printf "%s %3d%%\n" "$status" "$capacity";
|
||||||
|
Reference in New Issue
Block a user