Add lock functions to idle script
This commit is contained in:
parent
b0ec5cdafb
commit
b74c0f0faf
21
sway/idle.sh
21
sway/idle.sh
|
@ -4,14 +4,13 @@ BLFILE="/home/jpm/.config/blc.last"
|
||||||
OPFILE="/home/jpm/.config/active_outputs"
|
OPFILE="/home/jpm/.config/active_outputs"
|
||||||
|
|
||||||
if [ -z $1 ]; then
|
if [ -z $1 ]; then
|
||||||
echo "Missing argument: run, warn, sleep or" \
|
echo "Missing argument: start, warn, lock, unlock, sleep, wake, or resume"
|
||||||
" wake"
|
|
||||||
elif [ $1 == "start" ]; then
|
elif [ $1 == "start" ]; then
|
||||||
swayidle -w timeout 270 "/home/jpm/scripts/sway/idle.sh warn" \
|
swayidle -w timeout 270 "/home/jpm/scripts/sway/idle.sh warn" \
|
||||||
resume "/home/jpm/scripts/sway/idle.sh resume" \
|
resume "/home/jpm/scripts/sway/idle.sh resume" \
|
||||||
timeout 300 "/home/jpm/scripts/sway/idle.sh sleep" \
|
timeout 300 "/home/jpm/scripts/sway/idle.sh sleep" \
|
||||||
resume "/home/jpm/scripts/sway/idle.sh wake" \
|
resume "/home/jpm/scripts/sway/idle.sh wake" \
|
||||||
before-sleep "/usr/bin/swaylock -c 323232"
|
before-sleep "/usr/bin/swaylock -c 000000"
|
||||||
elif [ $1 == "warn" ]; then
|
elif [ $1 == "warn" ]; then
|
||||||
# Store current brightness
|
# Store current brightness
|
||||||
echo $(/home/jpm/scripts/thinkpad/blc.pl %) > $BLFILE
|
echo $(/home/jpm/scripts/thinkpad/blc.pl %) > $BLFILE
|
||||||
|
@ -19,12 +18,19 @@ elif [ $1 == "warn" ]; then
|
||||||
/home/jpm/scripts/thinkpad/blc.pl = 1
|
/home/jpm/scripts/thinkpad/blc.pl = 1
|
||||||
# Warning notifications
|
# Warning notifications
|
||||||
/home/jpm/scripts/sway/idlecountdown.sh
|
/home/jpm/scripts/sway/idlecountdown.sh
|
||||||
|
elif [ $1 == "lock" ]; then
|
||||||
|
echo $(/home/jpm/scripts/thinkpad/blc.pl %) > $BLFILE
|
||||||
|
/home/jpm/scripts/thinkpad/blc.pl = 1
|
||||||
|
ssh jpm@john.me.tz -i /home/jpm/.ssh/no_pass -t \
|
||||||
|
'screen -S irssi -X stuff "/nick jpmAFK^M"'
|
||||||
|
elif [ $1 == "unlock" ]; then
|
||||||
|
/home/jpm/scripts/thinkpad/blc.pl = `cat $BLFILE`
|
||||||
elif [ $1 == "sleep" ]; then
|
elif [ $1 == "sleep" ]; then
|
||||||
# Change nick to AFK
|
# Change nick to AFK
|
||||||
ssh jpm@john.me.tz -i /home/jpm/.ssh/no_pass -t \
|
ssh jpm@john.me.tz -i /home/jpm/.ssh/no_pass -t \
|
||||||
'screen -S irssi -X stuff "/nick jpmAFK^M"'
|
'screen -S irssi -X stuff "/nick jpmAFK^M"'
|
||||||
# Turn off monitor
|
# Turn off monitor
|
||||||
for i in `cat $OPFILE`; do swaymsg "output $i dpms off"; done
|
#for i in `cat $OPFILE`; do swaymsg "output $i dpms off"; done
|
||||||
elif [ $1 == "wake" ]; then
|
elif [ $1 == "wake" ]; then
|
||||||
# Kill additional counters that might have been started
|
# Kill additional counters that might have been started
|
||||||
/home/jpm/scripts/sway/idle.sh resume
|
/home/jpm/scripts/sway/idle.sh resume
|
||||||
|
@ -32,12 +38,13 @@ elif [ $1 == "wake" ]; then
|
||||||
/home/jpm/scripts/sway/displays.pl
|
/home/jpm/scripts/sway/displays.pl
|
||||||
#for i in `cat $OPFILE`; do swaymsg "output $i dpms on"; done
|
#for i in `cat $OPFILE`; do swaymsg "output $i dpms on"; done
|
||||||
# Lock screen
|
# Lock screen
|
||||||
swaylock -c 323232
|
swaylock -c 000000
|
||||||
# Restore brightness level
|
# Restore brightness level
|
||||||
/home/jpm/scripts/thinkpad/blc.pl = $(cat $BLFILE)
|
/home/jpm/scripts/thinkpad/blc.pl = $(cat $BLFILE)
|
||||||
elif [ $1 == "resume" ]; then
|
elif [ $1 == "resume" ]; then
|
||||||
# Kill warning
|
# Kill warning
|
||||||
for i in `pgrep idlecountdown`; do kill $i; done
|
for i in `pkill idlecountdown`; do kill $i; done
|
||||||
|
/home/jpm/scripts/thinkpad/blc.pl = $(cat $BLFILE)
|
||||||
else
|
else
|
||||||
echo "Invalid argument: run, sleep or wake"
|
echo "Invalid argument: start, warn, lock, unlock, sleep, wake, or resume"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue