Skip to content

Instantly share code, notes, and snippets.

@jaywon
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save jaywon/ae1970b207eaa24c8414 to your computer and use it in GitHub Desktop.

Select an option

Save jaywon/ae1970b207eaa24c8414 to your computer and use it in GitHub Desktop.
Monitor and notification script to show low battery when not using Unity or other desktop manager in Ubuntu
#!/bin/bash
while true
do
BATTERY_LEVEL=$(</sys/class/power_supply/BAT0/capacity)
if [ "$BATTERY_LEVEL" -lt "15" ]; then
notify-send -t 100 "Battery level is $BATTERY_LEVEL"
fi
sleep 100
done
@reboot /path/to/batterymonitor.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment