Bug 82485

Summary: RFE: Allow handling of laptop lid switch even if multiple monitors are detected
Product: systemd Reporter: Ben Wolsieffer <benwolsieffer>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: enhancement    
Priority: medium CC: benwolsieffer, cg, damien
Version: unspecified   
Hardware: All   
OS: All   
i915 platform: i915 features:
Attachments: Adds a HandleLidSwitchDocked option to logind.conf
Adds a HandleLidSwitchDocked option to logind.conf + documentation

Description Ben Wolsieffer 2014-08-12 00:30:10 UTC
Recently, the change was made to prevent laptops using systemd from suspending when the lid is closed if an external monitor was detected. This behavior is useful if one wants to use a docking station.

I would like to propose that this feature should become configurable so that users  can allow the laptop to sleep even if it is docked if they want to.

This seems fairly easy to implement; an boolean option with a name like "LidSwitchSuspendIfDocked" could be added with the default being "no", so the current functionality will remain for users who want it, but it would still be possible to suspend regardless of docking state (w/o using things like acpid).
Comment 1 Ben Wolsieffer 2014-08-18 20:46:17 UTC
Created attachment 104843 [details] [review]
Adds a HandleLidSwitchDocked option to logind.conf

This patch makes it possible to define the lid switch closing behavior when the laptop is docked.

By default the value of "HandleLidSwitchDocked" is "ignore", which maintains the current behavior of not suspending when the lid is closed, but it can be changed to any value that the other "HandleXxx" options support (suspend, hibernate, etc.).
Comment 2 Lennart Poettering 2014-08-18 21:44:37 UTC
Patch looks incomplete, you never invoke the new call you added?

Also, please update the man page for this.

I'd prefer if the item could be named slightly more generically. Maybe "LidSwitchIgnoreDocked=" or so.
Comment 3 Lennart Poettering 2014-08-18 21:44:52 UTC
*** Bug 80309 has been marked as a duplicate of this bug. ***
Comment 4 Ben Wolsieffer 2014-08-19 01:37:44 UTC
Created attachment 104854 [details] [review]
Adds a HandleLidSwitchDocked option to logind.conf + documentation

Sorry about that, I missed a file in the patch.

I also added the man page to the patch, see if you think it's clear enough.

The option name can be changed, but the one you suggested doesn't really fit. This option does not do what I originally suggested in my request, but instead allows the user to define any action to occur when the lid is closed and the laptop is docked. I chose this design (rather than just a boolean to enable suspending while docked) because it allows for more flexibility.

Another note: when GNOME 3 is running on the system, it still won't suspend because GNOME also inhibits suspending when multiple monitors are attached and they don't want to add a way to disable it. Here is my bug report with more info: https://bugzilla.gnome.org/show_bug.cgi?id=734964
Comment 5 Lennart Poettering 2014-08-26 20:09:20 UTC
Thanks! Applied!

(next time, please attach a proper git-format-patch formatted patch, thanks!)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.