From e8d885e28009ecc5246e613fd2a671068375dfb8 Mon Sep 17 00:00:00 2001 From: Ivan Bushchik Date: Sun, 20 Nov 2022 10:49:12 +0300 Subject: [PATCH] Add lock keybind & script --- configs/sway/config | 4 ++-- configs/sway/lock.sh | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100755 configs/sway/lock.sh diff --git a/configs/sway/config b/configs/sway/config index 432fe9b..cf4f045 100644 --- a/configs/sway/config +++ b/configs/sway/config @@ -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 diff --git a/configs/sway/lock.sh b/configs/sway/lock.sh new file mode 100755 index 0000000..79c674c --- /dev/null +++ b/configs/sway/lock.sh @@ -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 %%