X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-action.c;h=da5a8305fa9af4f1ec248e0fadaa4e086c09a2c5;hb=6a79c58603ea816a1b4fa1520397b4e138bc1ca0;hp=3bad92271349bbfc072ba1940d3d53b571ab2fbd;hpb=ed4ba7e4f652150310d062ffbdfefb4521ce1054;p=elogind.git diff --git a/src/login/logind-action.c b/src/login/logind-action.c index 3bad92271..da5a8305f 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -70,6 +70,22 @@ int manager_handle_action( return 0; } + /* 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 */ if (inhibit_key > 0) { if (manager_is_inhibited(m, inhibit_key, INHIBIT_BLOCK, NULL, true, false, 0, NULL)) {