[Issue] Resume does not turn on screen again, unless the session (swaylock) is unlocked
secrichard opened this issue · 3 comments
I'm using the following configuration in my `~/.config/sway/config:
The goal was to first turn off the screen and only after a while, lock the session. However, the screen remains turned off, even if activity is resumed on the lockscreen (i.e. typing the password or mouse movement).
What approach can I take, to have the screen turn on again, once activity is detected on swaylock?
exec swayidle -w \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
timeout 1800 'swaylock' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock'
sway version 1.7 on Debian 12.
I've also just stumbled upon this. That is intended behavior I think. The -w
flag tells swayidle to wait until commands complete before processing the next event. swaylock exits after unlocking by default. So with this setup, swayidle waits for swaylock to unlock before moving on to the resume command.
swaylock -f
daemonizes after locking. So the following config does what you want:
exec swayidle -w \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
timeout 1800 'swaylock -f' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -f'
(The resume command after swaylock might be redundant.)
There's a hint about -w
and -f
in the example section of swayidle(1)
but it doesn't talk about this issue specifically.
Correct, this behavior is intentional. When using swayidle -w
, swaylock should daemonize with -f
if you want other timeout/resume events to trigger in parallel. The point of swayidle -w
is to allow ordering where you know that a previous command has completed before the next timeout or resume event occurs.
Thank you for the feedback! I've overlooked that detail!