[gnome-settings-daemon/docking-stations: 590/590] bgo#657201 [power] - Allow forcing suspend when closing the lid in the presence of external monitors



commit f10c8922ef4ead58ac0389144c2d0b16e872067e
Author: Paolo Bonzini <bonzini gnu org>
Date:   Wed May 16 11:38:21 2012 -0500

    bgo#657201 [power] - Allow forcing suspend when closing the lid in the presence of external monitors
    
    Some people want, "suspend the laptop when I close its lid, even if an external monitor
    is present", so that they can close the lid at the end of the day.  Others want,
    "don't suspend the laptop when I close its lid if an external monitor is present",
    which is the behavior introduced in bgo#663126, and serves common usage of docking stations
    or laptops as media players when connected to a TV.  This commit introduces
    an org.gnome.settings-daemon.plugins.power.lid-close-suspend-with-external-monitors key,
    with a default of False, that allows changing the default behavior.

 ...settings-daemon.plugins.power.gschema.xml.in.in |   11 +++++++++++
 plugins/power/gsd-power-manager.c                  |    3 ++-
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
index 7b02f0b..736618b 100644
--- a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
+++ b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
@@ -92,6 +92,17 @@
       <summary>Laptop lid close action when on AC</summary>
       <description>The action to take when the laptop lid is closed and the laptop is on AC power.</description>
     </key>
+    <key name="lid-close-suspend-with-external-monitor" type="b">
+      <default>false</default>
+      <summary>Laptop lid, when closed, will suspend even if there is an external monitor plugged in</summary>
+      <description>With no external monitors plugged in, closing a laptop's lid
+	will suspend the machine (as set by the lid-close-battery-action and
+	lid-close-ac-action keys).  However, when an external monitor is plugged in to
+	the laptop, closing the lid will not suspend the machine so that one can keep
+	working on that monitor (e.g. for docking stations or media viewers).  Set this
+	key to False to take this action, or to True to suspend the laptop whenever the
+	lid is closed and regardless of external monitors.</description>
+    </key>
     <key name="critical-battery-action" enum="org.gnome.settings-daemon.GsdPowerActionType">
       <default>'hibernate'</default>
       <summary>Battery critical low action</summary>
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 5986a80..d931861 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -2345,7 +2345,8 @@ do_lid_closed_action (GsdPowerManager *manager)
         }
 
         /* perform policy action */
-        if (non_laptop_outputs_are_all_off (manager->priv->x11_screen)) {
+        if (g_settings_get_boolean (manager->priv->settings, "lid-close-suspend-with-external-monitor")
+            || non_laptop_outputs_are_all_off (manager->priv->x11_screen)) {
                 g_debug ("lid is closed; suspending or hibernating");
                 do_power_action_type (manager, action_type);
         } else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]