mirror of
https://github.com/captn3m0/Scripts.git
synced 2024-09-29 04:04:03 +00:00
11 lines
417 B
Bash
11 lines
417 B
Bash
|
#!/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
|