mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-02 11:03:57 +00:00
xsession: add config option to let systemd handle lid/power events
This commit is contained in:
parent
fd6b48783d
commit
57dc4b9188
@ -39,12 +39,15 @@ let
|
|||||||
exec > ~/.xsession-errors 2>&1
|
exec > ~/.xsession-errors 2>&1
|
||||||
''}
|
''}
|
||||||
|
|
||||||
# Stop systemd from handling the power button and lid switch,
|
${optionalString cfg.displayManager.desktopManagerHandlesLidAndPower ''
|
||||||
# since presumably the desktop environment will handle these.
|
# Stop systemd from handling the power button and lid switch,
|
||||||
if [ -z "$_INHIBITION_LOCK_TAKEN" ]; then
|
# since presumably the desktop environment will handle these.
|
||||||
export _INHIBITION_LOCK_TAKEN=1
|
if [ -z "$_INHIBITION_LOCK_TAKEN" ]; then
|
||||||
exec ${config.systemd.package}/bin/systemd-inhibit --what=handle-lid-switch:handle-power-key "$0" "$sessionType"
|
export _INHIBITION_LOCK_TAKEN=1
|
||||||
fi
|
exec ${config.systemd.package}/bin/systemd-inhibit --what=handle-lid-switch:handle-power-key "$0" "$sessionType"
|
||||||
|
fi
|
||||||
|
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString cfg.startOpenSSHAgent ''
|
${optionalString cfg.startOpenSSHAgent ''
|
||||||
if test -z "$SSH_AUTH_SOCK"; then
|
if test -z "$SSH_AUTH_SOCK"; then
|
||||||
@ -185,6 +188,16 @@ in
|
|||||||
description = "Shell commands executed just before the window or desktop manager is started.";
|
description = "Shell commands executed just before the window or desktop manager is started.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
desktopManagerHandlesLidAndPower = mkOption {
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether the display manager should prevent systemd from handling
|
||||||
|
lid and power events. This is normally handled by the desktop
|
||||||
|
environment's power manager. Turn this off when using a minimal
|
||||||
|
X11 setup without a full power manager.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
session = mkOption {
|
session = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
example = [
|
example = [
|
||||||
|
Loading…
Reference in New Issue
Block a user