From 8e0d77632e02720a8adf8126f126990501299191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sat, 16 Nov 2013 20:25:38 +0100 Subject: [PATCH] Revert "new systemd can't inhibit lid switches" This reverts commit f9fb7b7457e636f4f7edff866cee1c1812aa9501. Cf. https://github.com/jcumming/nixos/commit/da2c160471f73af --- .../modules/services/x11/display-managers/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index bb86786f0f2..c4fce3706dc 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -39,6 +39,16 @@ let exec > ~/.xsession-errors 2>&1 ''} + ${optionalString cfg.displayManager.desktopManagerHandlesLidAndPower '' + # Stop systemd from handling the power button and lid switch, + # since presumably the desktop environment will handle these. + if [ -z "$_INHIBITION_LOCK_TAKEN" ]; then + export _INHIBITION_LOCK_TAKEN=1 + exec ${config.systemd.package}/bin/systemd-inhibit --what=handle-lid-switch:handle-power-key "$0" "$sessionType" + fi + + ''} + ${optionalString cfg.startOpenSSHAgent '' if test -z "$SSH_AUTH_SOCK"; then # Restart this script as a child of the SSH agent. (It is