Allow specifying a specific mode as an argument
This commit is contained in:
parent
4edd9a297d
commit
7af9d67b29
|
@ -1,11 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
FILE="$HOME/.spool/idle_mode"
|
||||
if [ -e $FILE ]; then
|
||||
if [[ -z $1 ]] || [[ "$1" == 'rotate' ]] || [[ "$1" == 'bar' ]]; then
|
||||
if [[ -e $FILE ]]; then
|
||||
MODE=$(cat $FILE)
|
||||
else
|
||||
else
|
||||
MODE="fade"
|
||||
echo -n $MODE >$FILE
|
||||
fi
|
||||
else
|
||||
MODE="$1"
|
||||
fi
|
||||
|
||||
if [[ $MODE == "none" ]]; then
|
||||
|
@ -28,13 +31,15 @@ elif [[ $MODE == "hibernate" ]]; then
|
|||
NEXT="none"
|
||||
else
|
||||
echo "Invalid mode: $MODE"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -z $1 ] || [ "$1" == "bar" ]; then
|
||||
if [[ -z $1 ]] || [[ "$1" == "bar" ]]; then
|
||||
echo '{"text":"'$ICON'","icon":"'$ICON'","tooltip":"Change sleep mode ('$MODE')","class":"'$MODE'"}'
|
||||
elif [ "$1" == "rotate" ]; then
|
||||
echo -n $NEXT >$FILE
|
||||
$0 bar
|
||||
else
|
||||
echo "Invalid argumuent $1"
|
||||
echo -n $MODE >$FILE
|
||||
$0 bar
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue