2022-11-30 17:47:37 -05:00
|
|
|
|
2022-12-01 14:12:07 -05:00
|
|
|
#check for acpi
|
|
|
|
if command -v acpi &> /dev/null; then
|
2022-12-01 14:23:52 -05:00
|
|
|
bat=$(acpi -b)
|
2022-12-01 14:12:07 -05:00
|
|
|
spd-say -P important -Cw "$bat"
|
|
|
|
else
|
|
|
|
find /sys/class/power_supply -type l -exec bash -c '
|
2022-11-30 17:47:37 -05:00
|
|
|
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
|
|
|
|
' _ {} \;
|
2022-12-01 14:12:07 -05:00
|
|
|
fi
|