sb-battery: cleanup
This commit is contained in:
parent
827311fb6a
commit
cdee5f6ce2
|
@ -9,12 +9,12 @@ for battery in /sys/class/power_supply/BAT?*; do
|
|||
capacity="$(cat "$battery/capacity" 2>&1)"
|
||||
case "$(cat "$battery/status" 2>&1)" in
|
||||
"Full")
|
||||
icon=""
|
||||
color="$fggreen"
|
||||
icon=""
|
||||
color="$fgcyan"
|
||||
;;
|
||||
"Not charging")
|
||||
icon=""
|
||||
color="$fggreen"
|
||||
color="$fgorange"
|
||||
;;
|
||||
"Unknown")
|
||||
icon=""
|
||||
|
@ -25,42 +25,21 @@ for battery in /sys/class/power_supply/BAT?*; do
|
|||
color="$fgcyan"
|
||||
;;
|
||||
"Discharging")
|
||||
if [ "$capacity" -le 10 ]; then
|
||||
icon=""
|
||||
color="$fgred"
|
||||
elif [ "$capacity" -le 20 ]; then
|
||||
icon=""
|
||||
color="$fgred"
|
||||
elif [ "$capacity" -le 30 ]; then
|
||||
icon=""
|
||||
color="$fgwhite"
|
||||
elif [ "$capacity" -le 40 ]; then
|
||||
icon=""
|
||||
color="$fgwhite"
|
||||
elif [ "$capacity" -le 50 ]; then
|
||||
icon=""
|
||||
color="$fgwhite"
|
||||
elif [ "$capacity" -le 60 ]; then
|
||||
icon=""
|
||||
color="$fgwhite"
|
||||
elif [ "$capacity" -le 70 ]; then
|
||||
icon=""
|
||||
color="$fgwhite"
|
||||
elif [ "$capacity" -le 80 ]; then
|
||||
icon=""
|
||||
color="$fgwhite"
|
||||
elif [ "$capacity" -le 90 ]; then
|
||||
icon=""
|
||||
color="$fgwhite"
|
||||
elif [ "$capacity" -le 100 ]; then
|
||||
icon=""
|
||||
color="$fgwhite"
|
||||
else
|
||||
icon=""
|
||||
color="$fgwhite"
|
||||
fi
|
||||
case $capacity in
|
||||
[0-5]) icon="" color="$fgred" ;;
|
||||
[6-9] | 10) icon="" color="$fgred" ;;
|
||||
1[1-9] | 20) icon="" color="$fgred" ;;
|
||||
2[1-9] | 30) icon="" color="$fgwhite" ;;
|
||||
3[1-9] | 40) icon="" color="$fgwhite" ;;
|
||||
4[1-9] | 50) icon="" color="$fgwhite" ;;
|
||||
5[1-9] | 60) icon="" color="$fgwhite" ;;
|
||||
6[1-9] | 70) icon="" color="$fgwhite" ;;
|
||||
7[1-9] | 80) icon="" color="$fgwhite" ;;
|
||||
8[1-9] | 90) icon="" color="$fgwhite" ;;
|
||||
9[1-9] | 100) icon="" color="$fgwhite" ;;
|
||||
esac
|
||||
;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
printf "%b" "<span $color>$icon</span> $capacity"
|
||||
done && printf "\\n"
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue