I have the following swayidle command in my sway config:
exec swayidle \
timeout 300 'swaylock -c 000000' \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -c 000000'
As expected, the first time I trigger system sleep, ie. with systemctl suspend, the screen is locked prior to suspend and I am forced to enter a password on resume.
However, after resuming, if I trigger another suspend the screen is not locked and I am not prompted for my password on the next resume.
This behavior occurs for both suspend and hibernate. It appears as if the before-sleep command is only being run the first time the system sleeps.
sway version 1.0-beta.1-138-gd19648a3 (Nov 4 2018, branch 'master')
Fixed by https://github.com/swaywm/sway/pull/3049, probably
before-sleep happens after resume. After I wake up my laptop, there's a fraction of a second where my screen is unlocked. #3198 sorta describes what I'm seeing.I often get a flash of the previous (unlocked) screen content before seeing the lock screen when I wake my laptop from sleep too. Standard Fedora 29/systemd and the config above.
Following here, rather than #3198. Just to confirm, running latest build on Arch, opening the lid for the first time runs swaylock as expected. After that, it fails to get triggered. No flash or anything, as some have reported, just the plain, unlocked desktop.
It seems that #3049 fixed the issue for me, but leaving the issue open for now since other issues are being discussed.
Maybe fixed by https://github.com/swaywm/sway/pull/3381?
@emersion The original issue was fixed by #3049, at least for me.
The remaining issue is a duplicate of https://github.com/swaywm/sway/issues/3119
This is not fixed for me. swayidle before-sleep only works once. This is in my ~/.config/sway/config:
exec swayidle -w \
timeout 300 'swaylock -f' \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -f'
Agreed, this still does not work for me. I have tried every suggestion from each of the linked bugs.
~/.config/sway/config.d/idle:
exec swayidle -w \
timeout 120 'swaylock -f -c 000000' \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -f -c 000000'
and, yes, ~/.config/sway/config sources that file, amongst others: include config.d/*. Perhaps we can re-open this?
Most helpful comment
This is not fixed for me. swayidle before-sleep only works once. This is in my
~/.config/sway/config: