wayfire icon indicating copy to clipboard operation
wayfire copied to clipboard

Implement dpms off on laptop lid close

Open mark-herbert42 opened this issue 2 years ago • 3 comments

Wayfire idle plugin implements dpms_timeout - so in general it can save power, but this can only be controlled manually. To make it work on laptop lid state I see 2 varians

  1. Implement something like DBUS messaging (like swaymsg dpms off commang in sway), so it can be triggered by acpid daemon taking care about detecting/handling lid switch state

2)Implement SWITCH inputs handling in Wayfire itself as it works with mouse and keyboard events and add one more binding to idle plugin setting dpms_timeout to 1sec when lid is closed.

I've also tried wlr-randr to switch display off/on using acpid - but that ends up in crash os some programs (screen openes with less windows on it) and if the closed lid time is long enough (more that about 15 seconds) - wayfire crash completely. So maybe there is a third way to make wayfire work Ok without any display connected - but that's something I do not understand at all.

mark-herbert42 avatar Jul 01 '23 07:07 mark-herbert42

Take a look at this issue: https://github.com/WayfireWM/wayfire/issues/455

There is a command that you can use to trigger DPMS on and off, and I think it should be relatively easy to listen to ACPID events or something of the sort with a script (like your approach 1)

ammen99 avatar Jul 04 '23 08:07 ammen99

I've also tried wlr-randr to switch display off/on using acpid - but that ends up in crash os some programs (screen openes with less windows on it) and if the closed lid time is long enough (more that about 15 seconds) - wayfire crash completely. So maybe there is a third way to make wayfire work Ok without any display connected - but that's something I do not understand at all.

wlr-randr will turn the monitor on and off which is a more 'serious' operation, if you can collect logs from the crash, it will be good to fix the bug, I expect it can happen during monitor hotplug.

ammen99 avatar Jul 04 '23 08:07 ammen99

I guess monitor hotplug is a bit different - you still have your built-in screen so on plugin in and out external monitor it just moves the windows to available output. I've tried that many times works like a charm. But when there is no output available at all

mark-herbert42 avatar Jul 04 '23 09:07 mark-herbert42

Closing since the solution is to set the DPMS state in acpid, either via the wlroots example client or by using something like https://sr.ht/~leon_plickat/wlopm/.

ammen99 avatar Mar 08 '24 11:03 ammen99