Merge pull request #108909 from thiagokokada/libinput-by-device-type
nixos/libinput: separate settings by mouse/touchpad
This commit is contained in:
commit
5153deedd8
|
@ -186,7 +186,7 @@
|
||||||
The driver has many options (see <xref linkend="ch-options"/>). For
|
The driver has many options (see <xref linkend="ch-options"/>). For
|
||||||
instance, the following disables tap-to-click behavior:
|
instance, the following disables tap-to-click behavior:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<xref linkend="opt-services.xserver.libinput.tapping"/> = false;
|
<xref linkend="opt-services.xserver.libinput.touchpad.tapping"/> = false;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
Note: the use of <literal>services.xserver.synaptics</literal> is deprecated
|
Note: the use of <literal>services.xserver.synaptics</literal> is deprecated
|
||||||
since NixOS 17.09.
|
since NixOS 17.09.
|
||||||
|
|
|
@ -430,6 +430,17 @@ http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/e
|
||||||
dynamically allocated uid.
|
dynamically allocated uid.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
The libinput module has been updated with the ability to configure mouse and touchpad settings separately.
|
||||||
|
The options in <literal>services.xserver.libinput</literal> have been renamed to <literal>services.xserver.libinput.touchpad</literal>,
|
||||||
|
while there is a new <literal>services.xserver.libinput.mouse</literal> for mouse related configuration.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Since touchpad options no longer apply to all devices, you may want to replicate your touchpad configuration in
|
||||||
|
mouse section.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
|
@ -3,23 +3,18 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let cfg = config.services.xserver.libinput;
|
let cfg = config.services.xserver.libinput;
|
||||||
|
|
||||||
xorgBool = v: if v then "on" else "off";
|
xorgBool = v: if v then "on" else "off";
|
||||||
in {
|
|
||||||
|
|
||||||
options = {
|
|
||||||
|
|
||||||
services.xserver.libinput = {
|
|
||||||
|
|
||||||
enable = mkEnableOption "libinput";
|
|
||||||
|
|
||||||
|
mkConfigForDevice = deviceType: {
|
||||||
dev = mkOption {
|
dev = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
example = "/dev/input/event0";
|
example = "/dev/input/event0";
|
||||||
description =
|
description =
|
||||||
''
|
''
|
||||||
Path for touchpad device. Set to null to apply to any
|
Path for ${deviceType} device. Set to null to apply to any
|
||||||
auto-detected touchpad.
|
auto-detected ${deviceType}.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,14 +180,63 @@ in {
|
||||||
Option "DragLockButtons" "L1 B1 L2 B2"
|
Option "DragLockButtons" "L1 B1 L2 B2"
|
||||||
'';
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
Additional options for libinput touchpad driver. See
|
Additional options for libinput ${deviceType} driver. See
|
||||||
<citerefentry><refentrytitle>libinput</refentrytitle><manvolnum>4</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>libinput</refentrytitle><manvolnum>4</manvolnum></citerefentry>
|
||||||
for available options.";
|
for available options.";
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkX11ConfigForDevice = deviceType: matchIs: ''
|
||||||
|
Identifier "libinput ${deviceType} configuration"
|
||||||
|
MatchDriver "libinput"
|
||||||
|
MatchIs${matchIs} "${xorgBool true}"
|
||||||
|
${optionalString (cfg.${deviceType}.dev != null) ''MatchDevicePath "${cfg.${deviceType}.dev}"''}
|
||||||
|
Option "AccelProfile" "${cfg.${deviceType}.accelProfile}"
|
||||||
|
${optionalString (cfg.${deviceType}.accelSpeed != null) ''Option "AccelSpeed" "${cfg.${deviceType}.accelSpeed}"''}
|
||||||
|
${optionalString (cfg.${deviceType}.buttonMapping != null) ''Option "ButtonMapping" "${cfg.${deviceType}.buttonMapping}"''}
|
||||||
|
${optionalString (cfg.${deviceType}.calibrationMatrix != null) ''Option "CalibrationMatrix" "${cfg.${deviceType}.calibrationMatrix}"''}
|
||||||
|
${optionalString (cfg.${deviceType}.clickMethod != null) ''Option "ClickMethod" "${cfg.${deviceType}.clickMethod}"''}
|
||||||
|
Option "LeftHanded" "${xorgBool cfg.${deviceType}.leftHanded}"
|
||||||
|
Option "MiddleEmulation" "${xorgBool cfg.${deviceType}.middleEmulation}"
|
||||||
|
Option "NaturalScrolling" "${xorgBool cfg.${deviceType}.naturalScrolling}"
|
||||||
|
${optionalString (cfg.${deviceType}.scrollButton != null) ''Option "ScrollButton" "${toString cfg.${deviceType}.scrollButton}"''}
|
||||||
|
Option "ScrollMethod" "${cfg.${deviceType}.scrollMethod}"
|
||||||
|
Option "HorizontalScrolling" "${xorgBool cfg.${deviceType}.horizontalScrolling}"
|
||||||
|
Option "SendEventsMode" "${cfg.${deviceType}.sendEventsMode}"
|
||||||
|
Option "Tapping" "${xorgBool cfg.${deviceType}.tapping}"
|
||||||
|
Option "TappingDragLock" "${xorgBool cfg.${deviceType}.tappingDragLock}"
|
||||||
|
Option "DisableWhileTyping" "${xorgBool cfg.${deviceType}.disableWhileTyping}"
|
||||||
|
${cfg.${deviceType}.additionalOptions}
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
|
||||||
|
imports =
|
||||||
|
(map (option: mkRenamedOptionModule ([ "services" "xserver" "libinput" option ]) [ "services" "xserver" "libinput" "touchpad" option ]) [
|
||||||
|
"accelProfile"
|
||||||
|
"accelSpeed"
|
||||||
|
"buttonMapping"
|
||||||
|
"calibrationMatrix"
|
||||||
|
"clickMethod"
|
||||||
|
"leftHanded"
|
||||||
|
"middleEmulation"
|
||||||
|
"naturalScrolling"
|
||||||
|
"scrollButton"
|
||||||
|
"scrollMethod"
|
||||||
|
"horizontalScrolling"
|
||||||
|
"sendEventsMode"
|
||||||
|
"tapping"
|
||||||
|
"disableWhileTyping"
|
||||||
|
"additionalOptions"
|
||||||
|
]);
|
||||||
|
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.xserver.libinput = {
|
||||||
|
enable = mkEnableOption "libinput";
|
||||||
|
mouse = mkConfigForDevice "mouse";
|
||||||
|
touchpad = mkConfigForDevice "touchpad";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,32 +256,10 @@ in {
|
||||||
|
|
||||||
services.udev.packages = [ pkgs.libinput.out ];
|
services.udev.packages = [ pkgs.libinput.out ];
|
||||||
|
|
||||||
services.xserver.config =
|
services.xserver.inputClassSections = [
|
||||||
''
|
(mkX11ConfigForDevice "mouse" "Pointer")
|
||||||
# General libinput configuration.
|
(mkX11ConfigForDevice "touchpad" "Touchpad")
|
||||||
# See CONFIGURATION DETAILS section of man:libinput(4).
|
];
|
||||||
Section "InputClass"
|
|
||||||
Identifier "libinputConfiguration"
|
|
||||||
MatchDriver "libinput"
|
|
||||||
${optionalString (cfg.dev != null) ''MatchDevicePath "${cfg.dev}"''}
|
|
||||||
Option "AccelProfile" "${cfg.accelProfile}"
|
|
||||||
${optionalString (cfg.accelSpeed != null) ''Option "AccelSpeed" "${cfg.accelSpeed}"''}
|
|
||||||
${optionalString (cfg.buttonMapping != null) ''Option "ButtonMapping" "${cfg.buttonMapping}"''}
|
|
||||||
${optionalString (cfg.calibrationMatrix != null) ''Option "CalibrationMatrix" "${cfg.calibrationMatrix}"''}
|
|
||||||
${optionalString (cfg.clickMethod != null) ''Option "ClickMethod" "${cfg.clickMethod}"''}
|
|
||||||
Option "LeftHanded" "${xorgBool cfg.leftHanded}"
|
|
||||||
Option "MiddleEmulation" "${xorgBool cfg.middleEmulation}"
|
|
||||||
Option "NaturalScrolling" "${xorgBool cfg.naturalScrolling}"
|
|
||||||
${optionalString (cfg.scrollButton != null) ''Option "ScrollButton" "${toString cfg.scrollButton}"''}
|
|
||||||
Option "ScrollMethod" "${cfg.scrollMethod}"
|
|
||||||
Option "HorizontalScrolling" "${xorgBool cfg.horizontalScrolling}"
|
|
||||||
Option "SendEventsMode" "${cfg.sendEventsMode}"
|
|
||||||
Option "Tapping" "${xorgBool cfg.tapping}"
|
|
||||||
Option "TappingDragLock" "${xorgBool cfg.tappingDragLock}"
|
|
||||||
Option "DisableWhileTyping" "${xorgBool cfg.disableWhileTyping}"
|
|
||||||
${cfg.additionalOptions}
|
|
||||||
EndSection
|
|
||||||
'';
|
|
||||||
|
|
||||||
assertions = [
|
assertions = [
|
||||||
# already present in synaptics.nix
|
# already present in synaptics.nix
|
||||||
|
|
Loading…
Reference in New Issue