Updated battery status script to check for acpi and use if present

This commit is contained in:
Aaron Hewitt 2022-12-01 19:12:07 +00:00
parent ccac3e4367
commit 9d664036a1

View File

@ -1,6 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
find /sys/class/power_supply -type l -exec bash -c ' #check for acpi
if command -v acpi &> /dev/null; then
spd-say -P important -Cw "$bat"
else
find /sys/class/power_supply -type l -exec bash -c '
for i ; do for i ; do
if [[ -e "$i/capacity" ]]; then if [[ -e "$i/capacity" ]]; then
bat="${i##*/}" bat="${i##*/}"
@ -10,4 +14,4 @@ find /sys/class/power_supply -type l -exec bash -c '
fi fi
done done
' _ {} \; ' _ {} \;
fi