battery script no longer uses pango

This commit is contained in:
Luke Smith 2020-02-28 16:34:46 -05:00
parent e826c95284
commit 6345394781
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -11,8 +11,10 @@ case $BLOCK_BUTTON in
- Text color reflects charge left" ;;
esac
capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit
status=$(cat /sys/class/power_supply/"$1"/status)
for battery in /sys/class/power_supply/BAT?
do
capacity=$(cat "$battery"/capacity) || exit
status=$(cat "$battery"/status)
if [ "$capacity" -ge 75 ]; then
color="#00ff00"
@ -29,4 +31,6 @@ fi
[ "$status" = "Charging" ] && color="#ffffff"
printf "<span color='%s'>%s%s%s</span>\n" "$color" "$(echo "$status" | sed -e "s/,//;s/Discharging/🔋/;s/Not charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')"
printf "%s%s%s\n" "$(echo "$status" | sed "s/,//;s/Discharging/🔋/;s/Not charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')"
done