From db2a4d144eab5917b95550ca727351cc9bd2c55a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 4 Oct 2012 21:44:24 -0400 Subject: [PATCH] xsession: Set a inhibitor to prevent systemd from handling the power button and lid --- modules/services/x11/display-managers/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/services/x11/display-managers/default.nix b/modules/services/x11/display-managers/default.nix index 528b3a6f7276..b94278d0b0d2 100644 --- a/modules/services/x11/display-managers/default.nix +++ b/modules/services/x11/display-managers/default.nix @@ -31,6 +31,13 @@ let exec > ~/.xsession-errors 2>&1 ''} + # 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 + ${config.system.build.systemd}/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