Added proper locking and screensaver

This commit is contained in:
Patrick Wadström 2020-06-03 13:51:29 +02:00
parent 4a6ddb5e4f
commit 842024c5ec
2 changed files with 23 additions and 4 deletions

View File

@ -24,10 +24,6 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
# Workspaces
set $ws1 1:C
# Assign wrkspaces for common apps
assign [class="^slack$"] $ws1
assign [class="^microsoft teams - preview$"] $ws1
for_window [class="^microsoft teams - preview$"] border none
# Key bindings
bindsym $mod+Return exec $term
@ -180,6 +176,20 @@ bindsym $mod+r mode "resize"
# }
#}
# --------------------------------------------------- #
# Screensaver + Locking
# --------------------------------------------------- #
set $lock swaylock -c 000000
exec swayidle -w \
timeout 300 $lock \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep $lock
set $lockman exec bash ~/.config/sway/lockman.sh
bindsym $mod+Mod1+Ctrl+l $lockman
# --------------------------------------------------- #
exec_always ~/.config/waybar/waybar.sh
#include /etc/sway/config.d/*

9
.config/sway/lockman.sh Normal 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 000000
# Kills last background task so idle timer doesn't keep running
kill %%