Allow for blocking of hibernation
This commit is contained in:
parent
ccc9cdd2a7
commit
419aebd384
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
FILE="$HOME/.spool/hibernate_inhibitor"
|
||||
if [ -e $FILE ]; then
|
||||
INHIBITED=1
|
||||
else
|
||||
INHIBITED=0
|
||||
fi
|
||||
|
||||
if [ -z $1 ] || [[ "$1" == "bar" ]]; then
|
||||
if [[ $INHIBITED == 1 ]]; then
|
||||
echo '{"text":"☕","icon":"☕","tooltip":"Allow hibernation","class":"enabled"}'
|
||||
else
|
||||
echo '{"text":"💤","icon":"💤","tooltip":"Prevent hibernation","class":"disabled"}'
|
||||
fi
|
||||
elif [[ "$1" == "toggle" ]]; then
|
||||
if [[ $INHIBITED == "1" ]]; then
|
||||
rm $FILE
|
||||
else
|
||||
touch $FILE
|
||||
fi
|
||||
else
|
||||
echo "Invalid argumuent $1"
|
||||
fi
|
Loading…
Reference in New Issue