https://bugs.kde.org/show_bug.cgi?id=485623
Jakob Petsovits <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 CC| |[email protected] Status|REPORTED |CONFIRMED --- Comment #1 from Jakob Petsovits <[email protected]> --- I'll mark this as confirmed. Natalie's opinion in Bug 457859 comment #13 regarded the "sleep" and "idle" inhibitors, which thankfully you've left out of this bug report so the comment doesn't apply here. In a series of comments from Bug 457859 comment #5 to Bug 457859 comment #10, I fumbled my way toward a possible approach for fixing this. The current interfaces provided by systemd make it difficult to handle this correctly without polling, so I submitted https://github.com/systemd/systemd/issues/32196 to ask for interface improvements. With polling, it would still be possible right now to implement "handle-lid-switch" inhibitors somewhat correctly. Summarizing my comments from the other bug, we would want to do something like this: * Add an extra enum value for lid-switch inhibition to PolicyAgent::RequiredPolicy. * In PolicyAgent::checkLogindInhibitions(), check to see if any "handle-lid-switch" inhibitors other than PowerDevil's own inhibitor are active at the time of lid closure. Set the policy if this is the case. * Make PolicyAgent aware of the current lid switch state. Probably by adding a method PolicyAgent::setLidClosed(bool) to be called from HandleButtonEvents::onLidClosedChanged(). * When the lid is closed, manually call PolicyAgent::checkLogindInhibitions() to get the latest state of non-PowerDevil "handle-lid-switch" inhibitors, because systemd won't notify us of changes unless we can get the aforementioned interface improvements. * In HandleButtonEvents::onLidClosedChanged(), after policies are updated, replace any configured action with a "DPMS off" in case we have a "handle-lid-switch" inhibitor present. Ensure we always either suspend or turn off the screen when the lid is closed, and always turn the screen back when the lid is opened again. * In the absence of observable inhibitor change signals from systemd, if an inhibitor was present on lid closure, add a polling timer to periodically call PolicyAgent::checkLogindInhibitions() as long as the lid is still closed. Stop polling when the lid gets opened again. * Execute the suspend action if the lid-switch inhibitor policy disappears while the lid is still closed. This approximate approach should make "handle-lid-switch" inhibitors work as expected. -- You are receiving this mail because: You are watching all bug changes.
