Add lock keybind & script

This commit is contained in:
Ivan Bushchik 2022-11-20 10:49:12 +03:00
parent 4cb16aa027
commit e8d885e280
No known key found for this signature in database
GPG key ID: 3E4E9C7D66E44BF7
2 changed files with 11 additions and 2 deletions

View file

@ -33,7 +33,7 @@ include ~/.config/sway/themes/solarized-dark
exec mako
exec poweralertd
exec swayidle -w timeout 300 'swaylock -f -c 000000' timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -f -c 000000'
exec swayidle -w timeout 60 'swaylock -f -c 073642' timeout 70 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -f -c 073642'
# Screenshots
@ -55,7 +55,7 @@ bindsym $mod+Shift+q kill
bindsym $mod+d exec $menu
floating_modifier $mod normal
bindsym $mod+Shift+c reload
bindsym $mod+Shift+e exec swaynag -f 'Ubuntu 9' -e bottom -t warning -m "What would you like to do?" -B 'Exit sway' 'swaymsg exit' -B 'Power off' 'systemctl poweroff' -B 'Reboot' 'systemctl reboot'
bindsym $mod+Shift+e exec swaynag -f 'JetBrains Mono 9' -e bottom -t warning -m "What would you like to do?" -B 'Exit sway' 'swaymsg exit' -B 'Power off' 'systemctl poweroff' -B 'Reboot' 'systemctl reboot' -B 'Lock screen' '$HOME/.config/sway/lock.sh'
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up

9
configs/sway/lock.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
# Times the screen off and puts it to background
swayidle \
timeout 10 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' &
# Locks the screen immediately
swaylock -c 073642
# Kills last background task so idle timer doesn't keep running
kill %%