From 153d0b5d13c5a33615a1c80e057718d8a173cb1c Mon Sep 17 00:00:00 2001 From: Daniil Tsivinsky Date: Tue, 26 Jul 2022 20:46:29 +0300 Subject: [PATCH] sway: setup swayidle --- bin/lock.sh | 7 ++++++- bin/swayidle.sh | 10 ++++++---- config/.config/wlogout/layout | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bin/lock.sh b/bin/lock.sh index e451870..b3e86f8 100755 --- a/bin/lock.sh +++ b/bin/lock.sh @@ -1,9 +1,14 @@ #! /bin/bash __lock() { - gtklock + gtklock -d } +if [[ "$1" == "just-lock" ]]; then + __lock + exit +fi + amount_of_outputs=$(swaymsg -t get_outputs | grep -i name | wc -l) if [[ "$amount_of_outputs" == "1" ]]; then diff --git a/bin/swayidle.sh b/bin/swayidle.sh index 5b32874..d3409cf 100755 --- a/bin/swayidle.sh +++ b/bin/swayidle.sh @@ -2,8 +2,10 @@ killall swayidle -cmd="$DOTFILES/bin/lock.sh" +lockCmd="$HOME/dotfiles/bin/lock.sh just-lock" -afterResumeCmd="swaymsg seat seat0 cursor set 300 300" - -swayidle before-sleep "$cmd" after-resume "$afterResumeCmd" +swayidle -w \ + timeout 900 "$lockCmd" \ + timeout 900 'swaymsg "output * dpms off"' \ + resume 'swaymsg "output * dpms on"' \ + before-sleep "$lockCmd" diff --git a/config/.config/wlogout/layout b/config/.config/wlogout/layout index 31481e1..9ebd03b 100644 --- a/config/.config/wlogout/layout +++ b/config/.config/wlogout/layout @@ -1,6 +1,6 @@ { "label": "lock", - "action": "$HOME/dotfiles/bin/lock.sh", + "action": "$HOME/dotfiles/bin/lock.sh just-lock", "text": "", "keybind": "l" },