Colorize battery statusbar script

master
Hektor Misplon 2022-05-11 12:27:21 +02:00
parent 77065ebe39
commit 331f04f73f
1 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
capacityStatus="$(cat /sys/class/power_supply/BAT0/capacity)" cap="$(cat /sys/class/power_supply/BAT0/capacity)"
printf "$capacityStatus%%" if [ "$cap" -ge 33 ];then
color="\x01"
elif [ "$cap" -ge 10 ]; then
color="\x03"
else
color="\x04"
fi
echo -n -e "$color $cap%"