swaywm / swayidle

Idle management daemon for Wayland
MIT License
554 stars 50 forks source link

Only the first timeout is triggered when suspending #144

Open WhyNotHugo opened 1 year ago

WhyNotHugo commented 1 year ago

I'm basically running swayidle timeout 10 "powerctl mem" while the screen is locked.

The first time the system reaches 10s idle, swayidle triggers, runs powerctl mem and puts it to sleep. I then press Return to wake the system up. swayidle doesn't trigger ever again.

I think that the keypress is "swallowed" by the system when asleep, so sway doesn't really know that any keypress happened. I wonder if maybe sway itself should reset the idle timer when woken up from sleep...? I don't think it even knows that this happened TBH.

The end result is that swayidle only triggers the first time. To be sincere, I'm not sure if this is a bug of a case of me using it wrong.

WhyNotHugo commented 1 year ago

I think what I need to do is somehow tell sway to "reset" it's idle timer when the system wakes up from sleep -- which would eventually make swayidle trigger as expected in this case.

I don't think sway has any such mechanism.

a-priestley commented 1 year ago

I'm having this issue with wake-on-lan. resume will not fire unless triggered by user input it seems.

fishman commented 1 year ago

I think what I need to do is somehow tell sway to "reset" it's idle timer when the system wakes up from sleep -- which would eventually make swayidle trigger as expected in this case.

That concept doesn't really exist. It's not part of sway it's part of the wayland idle notification protocol.

I just released sleepwatcher-rs(originally intended to call this swayidle-rs) which works around that problem by allowing for more logic in the configuration

https://github.com/fishman/sleepwatcher-rs/blob/master/lua_configs/idle_config.lua