mirror of https://github.com/captn3m0/Scripts.git
Adds a low battery cron job
- See https://bbs.archlinux.org/viewtopic.php?id=138755
This commit is contained in:
parent
ce30098bad
commit
cf7ca917a1
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
BATTINFO=`acpi -b`
|
||||
BATTERY=/sys/class/power_supply/BAT0
|
||||
REM=`grep "POWER_SUPPLY_CHARGE_NOW" $BATTERY/uevent | awk -F= '{ print $2 }'`
|
||||
FULL=`grep "POWER_SUPPLY_CHARGE_FULL_DESIGN" $BATTERY/uevent | awk -F= '{ print $2 }'`
|
||||
PERCENT=`echo $(( $REM * 100 / $FULL ))`
|
||||
|
||||
if [[ `echo $BATTINFO | grep Discharging` && "$PERCENT" -lt "10" ]] ; then
|
||||
DISPLAY=:0.0 /usr/bin/notify-send "low battery" "$BATTINFO"
|
||||
fi
|
Loading…
Reference in New Issue