Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: second timeout for DPMS when locked screen + idle #2

Open
camoz opened this issue Nov 28, 2018 · 9 comments
Open

FR: second timeout for DPMS when locked screen + idle #2

camoz opened this issue Nov 28, 2018 · 9 comments

Comments

@camoz
Copy link

camoz commented Nov 28, 2018

Hi all,

In the default sway config swayidle is started like so:
exec swayidle timeout 300 'swaylock -c 000000' timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -c 000000'

...which means, after 600 seconds the screen is locked and powered down. If I then move my mouse, screens are powered on and the lockscreen is shown. However, if I've moved my mouse only by accident, I have to wait the full DPMS timout before my screens are powered off again, right?

I thought it would be nice to have a second timeout for when that happens (maybe timeout --locked), so that I can say "please turn my screen off again if I don't start entering my password after 10 sec".

This feature is NOT really important to me, I more want to record this thought here, as it may be a useful feature.

Thanks for reading.

@emersion
Copy link
Member

I'm not sure we want to introduce more complexity in swayidle. Also, there's no good way for swayidle to detect if a lockscreen is running. I'd add another timeout that starts a script that detects if swaylock is running.

@progandy
Copy link

I thought about creating a dedicated session daemon that handles systemd and sway events for suspend, lid switch, screen lock, DPMS, logind idle flag and inhibiting those. I never got around to it since swayidle is currently good enough for me.

@emersion
Copy link
Member

emersion commented Nov 29, 2018

I thought about creating a dedicated session daemon that handles systemd and sway events for suspend, lid switch, screen lock, DPMS, logind idle flag and inhibiting those.

That would be neat.

@CameronNemo
Copy link

CameronNemo commented Nov 30, 2018

@progandy I use an upstart fork to manage my login sessions.

I integrate logind, swayidle, swaylock, and brillo.

@trbjo
Copy link

trbjo commented Dec 10, 2018

It is not necessary with new code. Swayidle can already do that.

From my config:

timeout 10 'if pgrep swaylock; then swaymsg "output * dpms off"; fi'\
resume 'swaymsg "output * dpms on"'\

@emersion emersion transferred this issue from swaywm/sway Jan 12, 2019
@Babadabupi
Copy link

Babadabupi commented Apr 7, 2019

This works really well, but for some reason this also causes my screen (or wallpaper by the looks of it) to flash momentarily, if the timeout of 10 seconds has passed, but the screen is not locked (and swaylock is not active).
Edit: To clarify - the screen flashes only i the timer is reset, so if i do nothing for 10 seconds (as in your example configuration) and then press a key, my wallpaper will flicker.

@RedSoxFan
Copy link
Member

RedSoxFan commented Apr 8, 2019

@Gigg1ty that sounds like swaywm/sway#3892

@jordanbray
Copy link

I use the following workaround to resolve this:

First, lock the screen at 300 seconds.
Next, turn off the screen at 330 seconds.
If there is keyboard/mouse movement, turn the screen back on.
If 'swaylock' is running, lock the screen at 30 seconds.
If there is mouse/kebyoard movement, and 'swaylock' is running, turn the screen back on.

This seems to resolve all of the issues listed here, including the screen flicker on swaymsg "output * dpms on" being run when the display is already active.

exec swayidle -w \
    timeout 300 $locker \
    timeout 330 'swaymsg "output * dpms off"' \
    resume 'swaymsg "output * dpms on"' \
    timeout 30 'if pgrep swaylock; then swaymsg "output * dpms off"; fi' \
    resume 'if pgrep swaylock; then swaymsg "output * dpms on"; fi' \
    before-sleep $locker

@sammko
Copy link

sammko commented Apr 20, 2022

Not only is swaybg restarted, but I get a pretty big lag spike (6 or 7 frames dropped) when output * dpms on is ran, despite being already on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

9 participants