Created
June 23, 2015 03:24
-
-
Save evamvid/a7231fca5e549d88871e to your computer and use it in GitHub Desktop.
PowerBlocker
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 | |
cat /sys/class/power_supply/BAT0/status | |
OUTPUT="$(cat /sys/class/power_supply/BAT0/status)" | |
echo "${OUTPUT}" | |
if [ "${OUTPUT}" = "Charging" ] || [ "${OUTPUT}" = "Unknown" ]; then | |
echo charging or full | |
elif [ "${OUTPUT}" = "Discharging" ]; then | |
notify-send -i /home/evamvid/Documents/Programming/OokiNoUse/power25.png "Hey there brother" "plug it in" | |
COUNTER=0 | |
while [ "$COUNTER" -le 12 ] | |
do | |
cat /sys/class/power_supply/BAT0/status | |
OUTPUT="$(cat /sys/class/power_supply/BAT0/status)" | |
echo "${OUTPUT}" | |
if [ "${OUTPUT}" = "Charging" ] || [ "${OUTPUT}" = "Unknown" ]; then | |
exit | |
elif [ "${OUTPUT}" = "Discharging" ]; then | |
COUNTER=$(($COUNTER+1)) | |
echo $COUNTER | |
sleep 1 | |
fi | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
preliminary bash script to stop computer from being used when the power is on. I don't even know if it works.