chiark / gitweb /
logind: ignore lid switch if more than 1 display is connected
[elogind.git] / src / login / logind-action.c
index c04f2107d1787d6f861c21a2568f383d88b157eb..da5a8305fa9af4f1ec248e0fadaa4e086c09a2c5 100644 (file)
@@ -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 */