Created
April 21, 2020 19:26
-
-
Save dhsathiya/88cba2a1ebb5a6025ae58aa1bcceb553 to your computer and use it in GitHub Desktop.
Notifies if battery is fully charged and/or low.
This file contains 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
# Crontab Entries | |
# Notify if battery is full (equal to 100%) | |
*/1 * * * * if [ $(cat /sys/class/power_supply/BAT0/capacity) -eq 100 ]; then XDG_RUNTIME_DIR=/run/user/$(id -u) notify-send Hey "Battery Full"; fi | |
# Notify if battery is low (less than or equal to 10%) | |
*/1 * * * * if [ $(cat /sys/class/power_supply/BAT0/capacity) -le 10 ]; then XDG_RUNTIME_DIR=/run/user/$(id -u) notify-send Hey "Battery Low"; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment