From d7fac4bbf607a894219065dc9b87f6d495d9ebab Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:36 +0100 Subject: feat(sway): browser-aware idle inhibits + post-resume lock grace Two related session-idle improvements: 1. ScreenSaver inhibit bridge. Browsers (LibreWolf/Chromium flatpaks) ask the session not to idle via the legacy org.freedesktop.ScreenSaver D-Bus API during video calls and fullscreen video; swayidle only honors logind's BlockInhibited property. Add inhibridge as a user unit to translate the former into the latter, so e.g. a Google Meet tab now keeps the screen from locking, dimming and (downstream) suspending. 2. Post-resume grace period. Locking on before-sleep meant every wake demanded the password even for a quick check. Replace with: before-sleep -> only pause media after-resume -> resume-lock-grace.sh 30 The grace script runs a one-shot swayidle that locks iff the user stays idle for 30s after the wake, with a watchdog that exits as soon as swaylock comes up (or after a hard cap) so it never lingers alongside the main swayidle. The 5-min main idle-lock and explicit loginctl lock-session paths are unchanged. --- dot_config/systemd/user/swayidle.service | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'dot_config/systemd/user/swayidle.service') diff --git a/dot_config/systemd/user/swayidle.service b/dot_config/systemd/user/swayidle.service index 8a99bfb..7f60847 100644 --- a/dot_config/systemd/user/swayidle.service +++ b/dot_config/systemd/user/swayidle.service @@ -1,16 +1,22 @@ [Unit] -Description=Idle manager for Wayland (lock + DPMS + before-sleep) +Description=Idle manager for Wayland (lock + DPMS + post-resume grace) PartOf=graphical-session.target After=graphical-session.target ConditionEnvironment=WAYLAND_DISPLAY [Service] Type=simple +# We deliberately do NOT lock on `before-sleep`; instead we lock only +# after a grace period post-resume, so a quick wake-and-keep-using +# doesn't require the password. `before-sleep` only pauses media so the +# call/track doesn't run on into suspend. The `lock` action still +# handles explicit `loginctl lock-session` immediately. ExecStart=/usr/bin/swayidle -w \ timeout 300 'swaylock -f -e -c 282828' \ timeout 360 'swaymsg "output * power off"' \ resume 'swaymsg "output * power on"' \ - before-sleep 'playerctl -a pause; swaylock -f -e -c 282828' \ + before-sleep 'playerctl -a pause' \ + after-resume '%h/.config/sway/resume-lock-grace.sh 30' \ lock 'swaylock -f -e -c 282828' Restart=on-failure RestartSec=2s -- cgit v1.3.1