From 63453947814838680f76f593d20d0e032c821f3e Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 28 Feb 2020 16:34:46 -0500 Subject: [PATCH] battery script no longer uses pango --- .local/bin/statusbar/battery | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery index d1631db..c52d9de 100755 --- a/.local/bin/statusbar/battery +++ b/.local/bin/statusbar/battery @@ -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 "%s%s%s\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 +