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