Added status to the output in the batteryzu script. fixed the shabang. Fixed formatting.

This commit is contained in:
stormdragon2976 2022-12-01 16:36:06 -05:00
parent 722a028c8f
commit 33e9a0668e
1 changed files with 12 additions and 11 deletions

View File

@ -1,17 +1,18 @@
#!/usr/bin/env bash
#check for acpi
if command -v acpi &> /dev/null; then
bat=$(acpi -b)
bat="$(acpi -b)"
spd-say -P important -Cw "$bat"
else
find /sys/class/power_supply -type l -exec bash -c '
for i ; do
if [[ -e "$i/capacity" ]]; then
bat="${i##*/}"
bat="${bat//BAT/Battery }"
bat="${bat}: $(cat "${i}/capacity") percent"
spd-say -P important -Cw "$bat"
fi
done
' _ {} \;
fi
for i ; do
if [[ -e "$i/capacity" ]]; then
bat="${i##*/}"
bat="${bat//BAT/Battery }"
bat="${bat}: $( { cat "${i}/status";echo -n ", "; cat "${i}/capacity"; } | tr -d \\n) percent."
spd-say -P important -Cw "$bat"
fi
done
' _ {} \;
fi