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

Do not suspend on laptop lid close when external monitors are connected #19

Closed
ids1024 opened this issue Jun 21, 2022 · 5 comments
Closed

Comments

@ids1024
Copy link
Member

ids1024 commented Jun 21, 2022

It seems the needs to be handled by using the Inhibit method on org.freedesktop.login1.Manager as is done by gnome-settings-daemon: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/blob/master/plugins/power/gsd-power-manager.c.

@Drakulix
Copy link
Member

I thought this is handled by setting HandleLidSwitchDocked to ignore in logind.conf. By forcing this behaviour through Inhibit there seems to be no way for the user to disable that, except for disable all Inhibit-calls using LidSwitchIgnoreInhibited.

@ids1024
Copy link
Member Author

ids1024 commented Jun 22, 2022

I think desktops like Gnome generally have their own configuration for these sorts of things rather than relying on logind's configuration file. As mentioned in that man page:

A different application may disable logind's handling of system power and sleep keys and the lid switch by taking a low-level inhibitor lock ("handle-power-key", "handle-suspend-key", "handle-hibernate-key", "handle-lid-switch", "handle-reboot-key"). This is most commonly used by graphical desktop environments to take over suspend and hibernation handling, and to use their own configuration mechanisms. If a low-level inhibitor lock is taken, logind will not take any action when that key or switch is triggered and the Handle*= settings are irrelevant.

Though what gnome-settings-daemon is doing is a bit different since it seems to set and unset the inhibitor instead of just inhibiting and handling this itself. And I don't see a gsetting related to this, so I guess it's not configurable on Gnome?

Though in that case, I wonder why I saw it suspending with external monitors plugged in...

@Drakulix
Copy link
Member

Ok, in that case is cosmic-comp the "correct" component to hold that inhibitor-lock? Or could this also be done e.g. by cosmic-session? I assume cosmic-comp could play a role here, because it is using logind to obtain privileges to take over devices, but does the inhibitor-lock depend on these privileges or could any process set that?

@ids1024
Copy link
Member Author

ids1024 commented Jun 22, 2022

Gnome handles this in gnome-settings-daemon, so presumably there's no reason we couldn't handle it in a separate daemon either. As long as it has a way to know how many displays are connected/enabled.

@XV-02
Copy link

XV-02 commented Feb 21, 2024

We appear to have resolved this. Testing from current master build ( 849882a ) I seek my system correctly suspend without an external display, while it does not suspend when I have an external display attached.

@XV-02 XV-02 closed this as completed Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants