dots/.bin/sb-battery

14 lines
213 B
Plaintext
Raw Normal View History

2021-12-31 16:01:55 +01:00
#!/usr/bin/env bash
2022-05-11 12:27:21 +02:00
cap="$(cat /sys/class/power_supply/BAT0/capacity)"
2021-12-31 16:01:55 +01:00
2022-05-11 12:27:21 +02:00
if [ "$cap" -ge 33 ];then
color="\x01"
elif [ "$cap" -ge 10 ]; then
color="\x03"
else
color="\x04"
fi
2022-05-16 11:39:33 +02:00
echo -n -e "$color $cap% \x01"