summaryrefslogtreecommitdiff
path: root/src/login/logind-button.c
diff options
context:
space:
mode:
authorSimon Fowler <simon.fowler@anu.edu.au>2018-02-10 02:37:39 +1000
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:58:50 +0200
commit8064341ad44a8c11ed570bea41893b1931142fb7 (patch)
treea0f61d1c2f59cbb373f23463d4cc504f5a00bd78 /src/login/logind-button.c
parent4ea9b5737fb009441667734864a08031152c671e (diff)
Suspend on lid close based on power status. (#8016)
This change adds support for controlling the suspend-on-lid-close behaviour based on the power status as well as whether the machine is docked or has an external monitor. For backwards compatibility the new configuration file variable is ignored completely by default, and must be set explicitly before being considered in any decisions.
Diffstat (limited to 'src/login/logind-button.c')
-rw-r--r--src/login/logind-button.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index 94945f0bc..2da6e6995 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -110,9 +110,13 @@ static void button_lid_switch_handle_action(Manager *manager, bool is_edge) {
assert(manager);
- /* If we are docked, handle the lid switch differently */
+ /* If we are docked or on external power, handle the lid switch
+ * differently */
if (manager_is_docked_or_external_displays(manager))
handle_action = manager->handle_lid_switch_docked;
+ else if (manager->handle_lid_switch_ep != _HANDLE_ACTION_INVALID &&
+ manager_is_on_external_power())
+ handle_action = manager->handle_lid_switch_ep;
else
handle_action = manager->handle_lid_switch;