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 +