scripts

Random scripts
git clone git://git.margiolis.net/scripts.git
Log | Files | Refs | README | LICENSE

batnfy (327B)


      1 #!/bin/sh
      2 
      3 perc=$(sysctl -n hw.acpi.battery.life)
      4 charg=$(sysctl -n hw.acpi.battery.state)
      5 
      6 export DISPLAY=":0.0" # cron cannot open the display without this.
      7 
      8 if [ ${perc} -le 10 ] && [ ${charg} -ne 2 ]; then
      9 	echo "Low battery" | nfy
     10 elif [ ${perc} -ge 99 ] && [ ${charg} -eq 2 ]; then
     11 	echo "Battery fully charged" | nfy
     12 fi