services.xserver: Disable Ctrl+Alt+Backspace by default

Ctrl+Alt+Backspace is usually enabled by default under X, and is a
keyboard shortcut that forcefully kills the current X server. This can
lead to data loss by users if accidentally pressed. This commit
introduces a new option, services.xserver.enableCtrlAltBackspace, that
is *disabled* by default. If set to true, the previous behavior can be
restored.

A similar decision was made by the Ubuntu team, and is documented here:
https://wiki.ubuntu.com/XorgCtrlAltBackspace
This commit is contained in:
Ollie Charles 2015-11-23 14:45:26 +00:00
parent d0589b0c54
commit 52f872ec27

View File

@ -409,6 +409,16 @@ in
if possible.
'';
};
enableCtrlAltBackspace = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable the DontZap option, which binds Ctrl+Alt+Backspace
to forcefully kill X. This can lead to data loss and is disabled
by default.
'';
};
};
};
@ -533,6 +543,7 @@ in
''
Section "ServerFlags"
Option "AllowMouseOpenFail" "on"
Option "DontZap" "${if cfg.enableCtrlAltBackspace then "off" else "on"}"
${cfg.serverFlagsSection}
EndSection