diff options
| author | 2026-05-13 13:43:36 +0100 | |
|---|---|---|
| committer | 2026-05-13 13:43:36 +0100 | |
| commit | 54662c8b95ce260ad0a8718e14850c96a66242ef (patch) | |
| tree | f1b36d6fd5b9cd15520da5340a724a46086cb608 /dot_config/sway | |
| parent | d7fac4bbf607a894219065dc9b87f6d495d9ebab (diff) | |
| download | dotfiles-54662c8b95ce260ad0a8718e14850c96a66242ef.tar.gz dotfiles-54662c8b95ce260ad0a8718e14850c96a66242ef.tar.bz2 dotfiles-54662c8b95ce260ad0a8718e14850c96a66242ef.zip | |
refactor(swayidle): drop bespoke post-resume grace script
Replaces the resume-lock-grace.sh + after-resume hook from the previous
commit with the simpler observation that sway already provides a wake
grace for free: it pauses the idle counter during suspend and resets it
on the first input event post-resume, so the existing timeout 300 lock
naturally gives ~5min to interact before locking. Just dropping the
before-sleep lock is enough; the script and after-resume directive were
overcomplicating it.
Diffstat (limited to 'dot_config/sway')
| -rw-r--r-- | dot_config/sway/executable_resume-lock-grace.sh | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/dot_config/sway/executable_resume-lock-grace.sh b/dot_config/sway/executable_resume-lock-grace.sh deleted file mode 100644 index 212eaa1..0000000 --- a/dot_config/sway/executable_resume-lock-grace.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# resume-lock-grace: lock the screen if the user stays idle for $1 -# (default 30) seconds after waking from suspend. Designed to be invoked -# from swayidle's `after-resume` so a quick wake-and-keep-using doesn't -# require typing the password, while a wake-and-walk-away still locks. -# -# Implementation: spawn a one-shot swayidle that locks once and exits. -# A watchdog kills it as soon as swaylock is detected, and a hard cap -# guarantees we never linger competing with the main swayidle. -set -eu - -GRACE="${1:-30}" -LOCK_CMD='swaylock -f -e -c 282828' -HARD_CAP=$((GRACE * 4)) - -# If a lock is already up (e.g. main swayidle already fired), do nothing. -pgrep -x swaylock >/dev/null && exit 0 - -swayidle -w timeout "$GRACE" "$LOCK_CMD" >/dev/null 2>&1 & -PID=$! - -elapsed=0 -while [ "$elapsed" -lt "$HARD_CAP" ]; do - if pgrep -x swaylock >/dev/null; then - break - fi - if ! kill -0 "$PID" 2>/dev/null; then - exit 0 - fi - sleep 1 - elapsed=$((elapsed + 1)) -done - -kill "$PID" 2>/dev/null || true -wait 2>/dev/null || true |
