Last active
August 29, 2015 14:04
-
-
Save alenbasic/2888865a8241dfc5170f to your computer and use it in GitHub Desktop.
Was assigned to a cron job and if the power was low would send a notification saying so.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this was initially designed for cinnamon, but cinnamon in its latest update offers this "out of the box" | |
export DISPLAY=:0.0 | |
charge=$(cat /sys/class/power_supply/BAT1/capacity) | |
status=$(cat /sys/class/power_supply/BAT1/status) | |
if [[ $status != "Charging" ]]; then | |
if [[ $charge < 20 ]]; then | |
notify-send "Charge now is at $charge%" "Plug it in now!" --icon=dialog-warning | |
elif [[ $charge < 10 ]]; then | |
notify-send "Charge now is at $charge%" "PLUG IT IN NOW!!!" --icon=dialog-warning | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment