fxde-core/scripts/posix/batman

15 lines
595 B
Plaintext
Raw Normal View History

2021-03-06 12:17:27 -05:00
#!/bin/sh
while true
do if [ -e /sys/class/power_supply/BAT1/capacity ] # Do we have a battery to monitor?
then sleep 60
2021-03-06 12:17:27 -05:00
x=`cat /sys/class/power_supply/BAT1/capacity`
if [ $x -le 25 ] # When do we notify the user?
2021-03-06 12:17:27 -05:00
do aplay $FVWM_USERDIR/sounds/CritNotif.wav &
printf "Battery alert!\nYour battery only has a remaining capacity of $x%!" | xmessage -file - -center
sleep 300 # Don't spam the user!!!
x=`cat /sys/class/power_supply/BAT1/capacity` # Obtain new value.
else exit
fi
2021-03-06 12:17:27 -05:00
done