dotfiles

My opinionated dotfiles
git clone git://git.erethon.com/dotfiles
Log | Files | Refs

commit 2cf6d5b52c682056e02459025eb59ff30014748e
parent 64f06c85fcbb9a498520e6499f59f067eabaa9ef
Author: Dionysis Grigoropoulos <dgrig@erethon.com>
Date:   Tue,  9 Feb 2016 03:44:41 +0200

bin: Update battery script

Diffstat:
bin/check-bat.sh | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/check-bat.sh b/bin/check-bat.sh @@ -1,6 +1,10 @@ WARN_LEVEL=$1 +FULL_LEVEL=$2 CURRENT_LEVEL=$(cat /sys/class/power_supply/BAT0/uevent | grep CAPACITY= | cut -d '=' -f 2) +STATUS=$(cat /sys/class/power_supply/BAT0/status) -if [ $CURRENT_LEVEL -lt $WARN_LEVEL ]; then +if [ $CURRENT_LEVEL -lt $WARN_LEVEL ] && [ $STATUS = 'Discharging' ]; then /usr/bin/notify-send "Low Battery" "Charge level is at $CURRENT_LEVEL%" +elif [ $CURRENT_LEVEL -ge $FULL_LEVEL ] && [ $STATUS = 'Charging' ]; then + /usr/bin/notify-send "Battery is charged" "Remove charger" fi