Public bug reported:

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)

** Affects: gnome-settings-daemon (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug focal wayland-session

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to gnome-settings-daemon in Ubuntu.
https://bugs.launchpad.net/bugs/1902911

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

Status in gnome-settings-daemon package in Ubuntu:
  New

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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-settings-daemon/+bug/1902911/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to