Created
February 13, 2018 15:32
-
-
Save ozgun/e9f596943f5e9b9790600c02b4f3e184 to your computer and use it in GitHub Desktop.
Battery status check
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
#!/bin/bash | |
# To see available batteries run "upower -e" | |
BATTERY_PERCENTAGE=`upower -i /org/freedesktop/UPower/devices/DisplayDevice |grep percentage |awk -F: '{ print $2}' |awk -F% '{gsub(/ /, ""); print $1 }' |awk -F, '{ print $1 }'` | |
if [ $((BATTERY_PERCENTAGE)) -lt 10 ]; then | |
notify-send -u critical -c device -i /usr/share/icons/gnome/48x48/status/battery-low.png "Battery Level Low!" "%$BATTERY_PERCENTAGE" | |
fi | |
# Crontab entry: | |
#*/3 * * * * export DISPLAY=:0.0 && /usr/local/bin/battery_status_check.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment