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).
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.).
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.
*** Bug 80309 has been marked as a duplicate of this bug. ***
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
(next time, please attach a proper git-format-patch formatted patch, thanks!)