From 6a79c58603ea816a1b4fa1520397b4e138bc1ca0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 3 Mar 2014 19:30:16 +0100 Subject: logind: ignore lid switch if more than 1 display is connected Previously we expected the desktop environment to take an inhibitor lock, but this opened a race on boot-up where logind might already be running but no DE is active. Hence, let's move checking for additional displays into logind. This also opens up this logic for other DEs, given that only GNOME implemented the inhibitor logic so far. --- src/login/logind-action.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/login/logind-action.c') diff --git a/src/login/logind-action.c b/src/login/logind-action.c index c04f2107d1..da5a8305fa 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -72,10 +72,18 @@ int manager_handle_action( /* If we are docked don't react to lid closing */ if (inhibit_key == INHIBIT_HANDLE_LID_SWITCH) { + int n; + if (manager_is_docked(m)) { log_debug("Ignoring lid switch request, system is docked."); return 0; } + + n = manager_count_displays(m); + if (n != 1) { + log_debug("Ignoring lid switch request, %s displays connected."); + return 0; + } } /* If the key handling is inhibited, don't do anything */ -- cgit v1.2.3-54-g00ecf