Display multiple power status bar icons again

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
This commit is contained in:
Willow Barraco
2023-04-05 16:25:07 +02:00
committed by Anjandev Momi
parent 3b771cf697
commit 4da4bb9b1e

View File

@@ -280,14 +280,13 @@ set_network() {
}
set_battery() {
count=0 # handle multiple batteries
for power_supply in /sys/class/power_supply/*; do
power_name="$(basename "$power_supply")"
fgcolor=default
bgcolor=default
style=normal
BATCMP=
if [ "$(cat "$power_supply"/type)" = "Battery" ]; then
if [ -e "$power_supply"/capacity ]; then
PCT="$(cat "$power_supply"/capacity)"
@@ -299,8 +298,6 @@ set_battery() {
continue
fi
count=$((count+1))
if [ -e "$power_supply"/status ]; then
# The status is not always given for the battery device.
# (sometimes it's linked to the charger device).
@@ -346,12 +343,12 @@ set_battery() {
fi
sxmobar -a -t "$style" -b "$bgcolor" -f "$fgcolor" \
battery-icon 40 "$BATCMP"
"battery-icon-$power_name" 40 "$BATCMP"
if [ -z "$SXMO_BAR_SHOW_BAT_PER" ]; then
sxmobar -d battery-status
sxmobar -d "battery-status-$power_name"
else
sxmobar -a battery-status 41 "$PCT%"
sxmobar -a "battery-status-$power_name" 41 "$PCT%"
fi
fi
done