Add a check to avoid extra spaces being printed

This commit is contained in:
2024-06-23 23:04:28 +01:00
parent 7d34c5348a
commit 3313178afc

View File

@@ -7,7 +7,7 @@
# for battery in /sys/class/power_supply/BAT?*; do # For standard devices, use this line instead.
for battery in /sys/class/power_supply/?*; do
# If non-first battery, print a space separator.
[ -n "${capacity+x}" ] && printf " "
[ -n "${capacity+x}" ] && [ -f "$battery/status" ] && printf " "
# Sets up the status and capacity
case "$(cat "$battery/status" 2>&1)" in
"Full") status="󰁹 " ;;