feat: turn off screen when locked
This commit is contained in:
parent
db0c1ecd0c
commit
81901c3d0f
27
bin/afk.sh
Executable file
27
bin/afk.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
screenoff(){
|
||||||
|
sleep 3
|
||||||
|
xset dpms force off
|
||||||
|
}
|
||||||
|
|
||||||
|
if mpc status | grep -F '[playing]'; then
|
||||||
|
mpc pause
|
||||||
|
RESTORE_MPD=1
|
||||||
|
fi
|
||||||
|
if command -v bluetoothctl >/dev/null; then
|
||||||
|
RESTORE_BLU=$(bluetoothctl show | grep -F "Powered: yes")
|
||||||
|
fi
|
||||||
|
if [ -n "$LOCKER" ]; then
|
||||||
|
screenoff &
|
||||||
|
$LOCKER
|
||||||
|
else
|
||||||
|
slock
|
||||||
|
fi
|
||||||
|
if [ "$RESTORE_MPD" = 1 ]; then
|
||||||
|
mpc play
|
||||||
|
fi
|
||||||
|
if [ -n "$RESTORE_BLU" ]; then
|
||||||
|
bluetoothctl power on
|
||||||
|
fi
|
|
@ -348,7 +348,7 @@ awful.screen.connect_for_each_screen(function(s)
|
||||||
onlogout = awful.quit,
|
onlogout = awful.quit,
|
||||||
onpoweroff = function() awful.spawn.with_shell("loginctl poweroff") end,
|
onpoweroff = function() awful.spawn.with_shell("loginctl poweroff") end,
|
||||||
onreboot = function() awful.spawn.with_shell("loginctl reboot") end,
|
onreboot = function() awful.spawn.with_shell("loginctl reboot") end,
|
||||||
onlock = function() awful.spawn.with_shell("loginctl lock-session") end,
|
onlock = function() awful.spawn.with_shell("afk.sh") end,
|
||||||
onsuspend = function() awful.spawn.with_shell("loginctl suspend") end,
|
onsuspend = function() awful.spawn.with_shell("loginctl suspend") end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user