GNOME desktop does not suspend on lid close with HDMI TV connected

Bug #1902911 reported by Andrei Borzenkov
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gnome-settings-daemon (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Ubuntu 20.04 with all current updates, GNOME/Wayland desktop, Dell Latitude E5450 notebook.

I have external TV connected via HDMI and I want notebook to suspend when I close lid even if TV is connected. This does not work. Even though logind is configured to suspend in this case:

$ cat /etc/systemd/logind.conf.d/allow-suspend-with-hdmi.conf
[Login]
HandleLidSwitchDocked=suspend
$

gnome-settings-daemon starts inhibitor as soon as it detects external monitor:

WHO UID USER PID COMM WHAT WHY MODE
bor 1001 bor 96600 gsd-power handle-lid-switch External monitor attached or configuration changed recently block

so sytemd-logind does not initiate suspend, but there is also no code in gnome-settings-daemon itself to handle lid close (as it completely relies on systemd-logind today).

Ubuntu package includes patch ubuntu-lid-close-suspend.patch that restores gsettings keys, but as there is no code to actually *use* these keys patch has no effect:

$ gsettings list-recursively org.gnome.settings-daemon.plugins.power | grep -w lid
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor true
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'
$

This most trivial (untested) patch to use this settings seems to be:

diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index c7a16e8d..9b7a99b5 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -1196,7 +1196,7 @@ upower_kbd_toggle (GsdPowerManager *manager,
 static gboolean
 suspend_on_lid_close (GsdPowerManager *manager)
 {
- return !external_monitor_is_connected (manager->rr_screen);
+ return g_settings_get_boolean (manager->settings, "lid-close-suspend-with-external-monitor") || !external_monitor_is_connected (manager->rr_screen);
 }

 static gboolean

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: gnome-settings-daemon 3.36.1-0ubuntu1
ProcVersionSignature: Ubuntu 5.8.0-25.26~20.04.1-generic 5.8.14
Uname: Linux 5.8.0-25-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.10
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Wed Nov 4 18:43:56 2020
DistributionChannelDescriptor:
 # This is a distribution channel descriptor
 # For more information see http://wiki.ubuntu.com/DistributionChannelDescriptor
 canonical-oem-somerville-trusty-amd64-20140620-0
InstallationDate: Installed on 2015-07-02 (1952 days ago)
InstallationMedia: Ubuntu 14.04 "Trusty" - Build amd64 LIVE Binary 20140620-04:25
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=ru_RU.UTF-8
 SHELL=/bin/bash
SourcePackage: gnome-settings-daemon
UpgradeStatus: Upgraded to focal on 2020-10-03 (32 days ago)

Revision history for this message
Andrei Borzenkov (arvidjaar-s) wrote :
Revision history for this message
Andrei Borzenkov (arvidjaar-s) wrote :

> This most trivial (untested) patch

I now built package with this test and it correctly suspends with external monitor connected.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and is a duplicate of bug 1793918, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally, any further discussion regarding the bug should occur in the other report. Feel free to continue to report any other bugs you may find.

Changed in gnome-settings-daemon (Ubuntu):
importance: Undecided → Low
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-settings-daemon (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.