dotfiles

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

check-bat.sh (462B)


      1 WARN_LEVEL=$1
      2 FULL_LEVEL=$2
      3 CURRENT_LEVEL=$(cat /sys/class/power_supply/BAT0/uevent | grep CAPACITY= | cut -d '=' -f 2)
      4 STATUS=$(cat /sys/class/power_supply/BAT0/status)
      5 
      6 if [ $CURRENT_LEVEL -lt $WARN_LEVEL ] && [ $STATUS = 'Discharging' ]; then
      7     /usr/bin/notify-send "Low Battery" "Charge level is at $CURRENT_LEVEL%"
      8 elif [ $CURRENT_LEVEL -ge $FULL_LEVEL ] && [ $STATUS = 'Charging' ]; then
      9     /usr/bin/notify-send "Battery is charged" "Remove charger"
     10 fi