GNOME Bugzilla – Bug 734964
Remove (duplicated) external displays handling
Last modified: 2019-03-20 11:17:24 UTC
Currently, gnome-settings-manager creates a systemd inhibitor that block suspending when the laptop lid is closed if multiple displays are attached. Since gnome no longer manages the lid switch, but instead lets systemd do it, gnome should not create this inhibitor. Also, the inhibitor is redundant, because systemd already prevents lid switch suspension if an external display or docking station is attached.
(In reply to comment #0) <snip> >Also, the inhibitor is redundant, > because systemd already prevents lid switch suspension if an external display > or docking station is attached. Citation needed.
From the man page (http://www.freedesktop.org/software/systemd/man/logind.conf.html): "Note that the lid switch is ignored if the system is inserted in a docking station, or if more than one display is connected."
I guess that would be: http://cgit.freedesktop.org/systemd/systemd/tree/src/login/logind-action.c#n73 which calls: http://cgit.freedesktop.org/systemd/systemd/tree/src/login/logind-core.c#n493 Except that it doesn't work for drivers that don't use drm (that's unfortunately still the case for the NVidia drivers). Look at the log for logind-action.c, in particular: commit d36d90933a832bd1e1eb8e3d16b3de73f91636b4 Author: Mantas Mikulėnas <grawity@gmail.com> Date: Mon Apr 28 00:58:56 2014 +0300 logind: allow suspending if there are no displays With proprietary graphics drivers, there won't be any 'drm' devices in sysfs, so logind will never suspend the system upon closing the lid, even if only one (internal) display is connected. This has been reported by multiple users so far. IMHO, it's better to suspend the system in this case for safety reasons, to avoid having nvidia blob users' laptops overheat, for the same reason that sleep inhibitors are overridden (LidSwitchIgnoreInhibited=yes). So GNOME will still need to do its work, unfortunately.
Thanks, that makes sense. Still, would it be possible to add an (dconf?) option to disable this feature? I am interested in this because I am working on patching systemd to allow suspending even if multiple monitors are connected. My patch works, except that it is being inhibited by gnome-setting-daemon. Perhaps it would be possible to bring back the "lid-close-suspend-with-external-monitor" option?
Not in gnome-settings-daemon, no. The code is fragile enough that I don't want to add another variable into the mix. We'll probably finally remove that when we use only Wayland...
Created attachment 283796 [details] [review] Adds an option to allow suspending with multiple monitors on lid close This patch is for users who want to patch their copy of gnome-settings-daemon to enable this functionality and I don't expect it to be accepted.
Created attachment 283800 [details] [review] Adds an option to allow suspending with multiple monitors on lid close Oops, I uploaded the wrong file the first time. :( This patch is for users who want to patch their copy of gnome-settings-daemon to enable this functionality and I don't expect it to be accepted. I don't know if it works perfectly, but it seems to work for me. It adds the "lid-close-suspend-with-external-monitor" to allow the computer so suspend on lid close if multiple monitors are connected.
Review of attachment 283800 [details] [review]: I'll mark this as reviewed, and I won't accept it, but I should note that the comments are not truthful. They should mention that systemd, by default, will take care of looking at the external displays.
Reopening. We can remove that code when we stop caring about external displays that don't use drm in the kernel (or we have some other way of detecting them).
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/248.