From 0eb776fd3a53b9e53c70c80bf47fe8e7d1400374 Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Wed, 14 Feb 2024 23:17:22 -0600 Subject: [PATCH] Override autolocker --- .../.config/sway/config.d/90-swayidle.conf | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 desktop-gruvbox-sway/.config/sway/config.d/90-swayidle.conf diff --git a/desktop-gruvbox-sway/.config/sway/config.d/90-swayidle.conf b/desktop-gruvbox-sway/.config/sway/config.d/90-swayidle.conf new file mode 100644 index 00000000..e84e465e --- /dev/null +++ b/desktop-gruvbox-sway/.config/sway/config.d/90-swayidle.conf @@ -0,0 +1,30 @@ +# Idle and lock configuration +# +# This will lock your screen after 300 seconds of inactivity, then turn off +# your displays after another 60 seconds, and turn your screens back on when +# resumed. It will also lock your screen before your computer goes to sleep. +# The timeouts can be customized via `$lock_timeout` and `$screen_timeout` +# variables. For a predictable behavior, keep the `$screen_timeout` value +# lesser than the `$lock_timeout`. +# +# You can also lock the screen manually by running `loginctl lock-session` or +# add a binding for the command. Example: +# bindsym $mod+Shift+Escape exec loginctl lock-session +# +# Note that all swaylock customizations are handled via /etc/swaylock/config and +# can be overridden via $XDG_CONFIG_HOME/swaylock/config (~/.config/swaylock/config). +# +# Requires: swayidle +# Requires: swaylock +# Requires: /usr/bin/pkill, /usr/bin/pgrep + +exec LT="$lock_timeout" ST="$screen_timeout" LT=${LT:-900} ST=${ST:-900} && \ + swayidle -w \ + timeout $LT 'swaylock -f' \ + timeout $((LT + ST)) 'swaymsg "output * power off"' \ + resume 'swaymsg "output * power on"' \ + timeout $ST 'pgrep -xu "$USER" swaylock >/dev/null && swaymsg "output * power off"' \ + resume 'pgrep -xu "$USER" swaylock >/dev/null && swaymsg "output * power on"' \ + before-sleep 'swaylock -f' \ + lock 'swaylock -f' \ + unlock 'pkill -xu "$USER" -SIGUSR1 swaylock'