Fix gammastep status file

This commit is contained in:
John Mertz 2023-04-09 13:18:09 -04:00
parent 2ef6def85f
commit 6b026a234b
Signed by: jpm
GPG Key ID: E9C5EA2D867501AB
1 changed files with 16 additions and 9 deletions

View File

@ -14,37 +14,44 @@ fi
if [[ $ACTION == 'bar' ]]; then
:
elif [[ $ACTION == 'toggle' ]]; then
if [ "$PID" ]; then
if [ ! -z $PID ]; then
kill -SIGUSR1 $PID
if [[ $RUNNING == 0 ]]; then
echo 1 > $HOME/.spool/gammastep.status
else
echo 0 > $HOME/.spool/gammastep.status
fi
else
echo 'Gammastep is not running'
fi
elif [[ $ACTION == 'start' ]]; then
if [ "$PID" ]; then
if [ ! -z $PID ]; then
echo 'Gammastep is already running'
else
$HOME/scripts/sway/gammastep.pl
fi
elif [[ $ACTION == 'stop' ]]; then
if [ "$PID" ]; then
if [ ! -z $PID ]; then
kill $PID
else
echo 'Gammastep is not running'
fi
elif [[ $ACTION == 'enable' ]]; then
if [ $PID ]; then
if [ $RUNNING ]; then
if [ ! -z $PID ]; then
if [[ $RUNNING != 0 ]]; then
echo 'Already enabled'
else
kill -SIGUSR1 $PID
echo 1 > $HOME/.spool/gammastep.status
fi
else
echo 'Gammastep is not running'
fi
elif [[ $ACTION == 'disable' ]]; then
if [ $PID ]; then
if [ ! -z $PID ]; then
if [ $RUNNING ]; then
kill -SIGUSR1 $PID
echo 0 > $HOME/.spool/gammastep.status
else
echo 'Already disabled'
fi
@ -59,8 +66,8 @@ RUNNING=0
if [ -e $HOME/.spool/gammastep.status ]; then
RUNNING=`cat $HOME/.spool/gammastep.status`
fi
if [ "$RUNNING" ]; then
echo '{"text":"ɣ","icon":"ɣ","tooltip":"Disable Gammastep","class":"enabled"}'
else
if [[ $RUNNING == 0 ]]; then
echo '{"text":"ɣ","icon":"ɣ","tooltip":"Enable Gammastep","class":"disabled"}'
else
echo '{"text":"ɣ","icon":"ɣ","tooltip":"Disable Gammastep","class":"enabled"}'
fi