Last active
September 10, 2019 18:56
-
-
Save xor3r/2d0874173c9ae0b032521f39098ff212 to your computer and use it in GitHub Desktop.
Alert messages in case of low charge level
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
#!/bin/bash | |
file="/sys/class/power_supply/BAT0/capacity" | |
while IFS= read -r line | |
do | |
if [[ "$line" -le 10 ]] | |
then | |
notify-send -u critical "CRITICAL CHARGE LEVEL (10%)" | |
else | |
exit | |
fi | |
done < "$file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to schedule this script to be run every certain amount of time, use the following command (example for every 5 minutes):
watch -n 300 ./batteryAlert.sh