2015-09-18 17:29:10 +02:00
|
|
|
|
{
|
|
|
|
|
config,
|
|
|
|
|
lib,
|
|
|
|
|
pkgs,
|
|
|
|
|
...
|
|
|
|
|
}:
|
2024-04-17 22:55:18 +02:00
|
|
|
|
let
|
|
|
|
|
cfg = config.services.libinput;
|
2024-12-10 20:26:33 +01:00
|
|
|
|
|
2021-01-10 00:46:13 -03:00
|
|
|
|
xorgBool = v: if v then "on" else "off";
|
2024-12-10 20:26:33 +01:00
|
|
|
|
|
2021-01-10 00:46:13 -03:00
|
|
|
|
mkConfigForDevice = deviceType: {
|
2024-08-27 20:43:20 +02:00
|
|
|
|
dev = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
2015-09-18 17:29:10 +02:00
|
|
|
|
default = null;
|
|
|
|
|
example = "/dev/input/event0";
|
|
|
|
|
description = ''
|
2021-11-15 08:37:26 -03:00
|
|
|
|
Path for ${deviceType} device. Set to `null` to apply to any
|
2021-01-10 00:46:13 -03:00
|
|
|
|
auto-detected ${deviceType}.
|
2015-09-18 17:29:10 +02:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
accelProfile = lib.mkOption {
|
|
|
|
|
type = lib.types.enum [
|
|
|
|
|
"flat"
|
|
|
|
|
"adaptive"
|
|
|
|
|
"custom"
|
|
|
|
|
];
|
2016-08-08 13:36:30 +02:00
|
|
|
|
default = "adaptive";
|
|
|
|
|
example = "flat";
|
2016-01-22 11:46:02 +01:00
|
|
|
|
description = ''
|
2021-11-15 08:37:26 -03:00
|
|
|
|
Sets the pointer acceleration profile to the given profile.
|
2024-05-10 18:18:02 +03:00
|
|
|
|
Permitted values are `adaptive`, `flat`, `custom`.
|
2016-08-08 13:36:30 +02:00
|
|
|
|
Not all devices support this option or all profiles.
|
|
|
|
|
If a profile is unsupported, the default profile for this is used.
|
|
|
|
|
`flat`: Pointer motion is accelerated by a constant
|
|
|
|
|
(device-specific) factor, depending on the current speed.
|
|
|
|
|
`adaptive`: Pointer acceleration depends on the input speed.
|
|
|
|
|
This is the default profile for most devices.
|
2024-05-10 18:18:02 +03:00
|
|
|
|
`custom`: Allows the user to define a custom acceleration function.
|
2024-05-12 17:30:33 +03:00
|
|
|
|
To define custom functions use the accelPoints<Fallback/Motion/Scroll>
|
|
|
|
|
and accelStep<Fallback/Motion/Scroll> options.
|
2016-01-22 11:46:02 +01:00
|
|
|
|
'';
|
2016-08-08 13:36:30 +02:00
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
accelSpeed = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
2015-09-18 17:29:10 +02:00
|
|
|
|
default = null;
|
2021-11-15 08:37:26 -03:00
|
|
|
|
example = "-0.5";
|
2024-05-12 17:33:27 +03:00
|
|
|
|
description = ''
|
|
|
|
|
Cursor acceleration (how fast speed increases from minSpeed to maxSpeed).
|
|
|
|
|
This only applies to the flat or adaptive profile.
|
|
|
|
|
'';
|
2015-09-18 17:29:10 +02:00
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
accelPointsFallback = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr (lib.types.listOf lib.types.number);
|
2024-05-12 17:30:33 +03:00
|
|
|
|
default = null;
|
2024-05-13 15:53:59 +03:00
|
|
|
|
example = [
|
|
|
|
|
0.0
|
|
|
|
|
1.0
|
|
|
|
|
2.4
|
|
|
|
|
2.5
|
|
|
|
|
];
|
2024-05-12 17:30:33 +03:00
|
|
|
|
description = ''
|
2024-05-13 15:53:59 +03:00
|
|
|
|
Sets the points of the fallback acceleration function. The value must be a list of
|
|
|
|
|
floating point non-negative numbers. This only applies to the custom profile.
|
2024-05-12 17:30:33 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
accelPointsMotion = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr (lib.types.listOf lib.types.number);
|
2024-05-12 17:30:33 +03:00
|
|
|
|
default = null;
|
2024-05-13 15:53:59 +03:00
|
|
|
|
example = [
|
|
|
|
|
0.0
|
|
|
|
|
1.0
|
|
|
|
|
2.4
|
|
|
|
|
2.5
|
|
|
|
|
];
|
2024-05-12 17:30:33 +03:00
|
|
|
|
description = ''
|
2024-05-13 15:53:59 +03:00
|
|
|
|
Sets the points of the (pointer) motion acceleration function. The value must be a
|
|
|
|
|
list of floating point non-negative numbers. This only applies to the custom profile.
|
2024-05-12 17:30:33 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
accelPointsScroll = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr (lib.types.listOf lib.types.number);
|
2024-05-12 17:30:33 +03:00
|
|
|
|
default = null;
|
2024-05-13 15:53:59 +03:00
|
|
|
|
example = [
|
|
|
|
|
0.0
|
|
|
|
|
1.0
|
|
|
|
|
2.4
|
|
|
|
|
2.5
|
|
|
|
|
];
|
2024-05-12 17:30:33 +03:00
|
|
|
|
description = ''
|
2024-05-13 15:53:59 +03:00
|
|
|
|
Sets the points of the scroll acceleration function. The value must be a list of
|
|
|
|
|
floating point non-negative numbers. This only applies to the custom profile.
|
2024-05-12 17:30:33 +03:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
accelStepFallback = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr lib.types.number;
|
2024-05-12 17:30:33 +03:00
|
|
|
|
default = null;
|
2024-05-13 15:53:59 +03:00
|
|
|
|
example = 0.1;
|
2024-05-12 17:30:33 +03:00
|
|
|
|
description = ''
|
|
|
|
|
Sets the step between the points of the fallback acceleration function. When a step of
|
|
|
|
|
0.0 is provided, libinput's Fallback acceleration function is used. This only applies
|
|
|
|
|
to the custom profile.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
accelStepMotion = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr lib.types.number;
|
2024-05-12 17:30:33 +03:00
|
|
|
|
default = null;
|
2024-05-13 15:53:59 +03:00
|
|
|
|
example = 0.1;
|
2024-05-12 17:30:33 +03:00
|
|
|
|
description = ''
|
|
|
|
|
Sets the step between the points of the (pointer) motion acceleration function. When a
|
|
|
|
|
step of 0.0 is provided, libinput's Fallback acceleration function is used. This only
|
|
|
|
|
applies to the custom profile.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
accelStepScroll = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr lib.types.number;
|
2024-05-12 17:30:33 +03:00
|
|
|
|
default = null;
|
2024-05-13 15:53:59 +03:00
|
|
|
|
example = 0.1;
|
2024-05-12 17:30:33 +03:00
|
|
|
|
description = ''
|
|
|
|
|
Sets the step between the points of the scroll acceleration function. When a step of
|
|
|
|
|
0.0 is provided, libinput's Fallback acceleration function is used. This only applies
|
|
|
|
|
to the custom profile.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
buttonMapping = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
2015-09-18 17:29:10 +02:00
|
|
|
|
default = null;
|
2021-11-15 08:37:26 -03:00
|
|
|
|
example = "1 6 3 4 5 0 7";
|
2015-09-18 17:29:10 +02:00
|
|
|
|
description = ''
|
2025-01-27 02:10:23 +01:00
|
|
|
|
Sets the logical button mapping for this device, see {manpage}`XSetPointerMapping(3)`. The string must
|
2015-09-18 17:29:10 +02:00
|
|
|
|
be a space-separated list of button mappings in the order of the logical buttons on the
|
|
|
|
|
device, starting with button 1. The default mapping is "1 2 3 ... 32". A mapping of 0 deac‐
|
|
|
|
|
tivates the button. Multiple buttons can have the same mapping. Invalid mapping strings are
|
|
|
|
|
discarded and the default mapping is used for all buttons. Buttons not specified in the
|
|
|
|
|
user's mapping use the default mapping. See section BUTTON MAPPING for more details.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
calibrationMatrix = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
2015-09-18 17:29:10 +02:00
|
|
|
|
default = null;
|
2021-11-15 08:37:26 -03:00
|
|
|
|
example = "0.5 0 0 0 0.8 0.1 0 0 1";
|
2015-09-18 17:29:10 +02:00
|
|
|
|
description = ''
|
2021-11-15 08:37:26 -03:00
|
|
|
|
A string of 9 space-separated floating point numbers. Sets the calibration matrix to the
|
2015-09-18 17:29:10 +02:00
|
|
|
|
3x3 matrix where the first row is (abc), the second row is (def) and the third row is (ghi).
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
clickMethod = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr (
|
|
|
|
|
lib.types.enum [
|
|
|
|
|
"none"
|
|
|
|
|
"buttonareas"
|
|
|
|
|
"clickfinger"
|
|
|
|
|
]
|
|
|
|
|
);
|
2016-01-22 11:46:02 +01:00
|
|
|
|
default = null;
|
2021-11-15 08:37:26 -03:00
|
|
|
|
example = "buttonareas";
|
2016-01-22 11:46:02 +01:00
|
|
|
|
description = ''
|
2017-10-09 12:07:19 -07:00
|
|
|
|
Enables a click method. Permitted values are `none`,
|
|
|
|
|
`buttonareas`, `clickfinger`.
|
2016-01-22 11:46:02 +01:00
|
|
|
|
Not all devices support all methods, if an option is unsupported,
|
2017-10-09 12:07:19 -07:00
|
|
|
|
the default click method for this device is used.
|
2016-01-22 11:46:02 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
2017-10-09 12:07:19 -07:00
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
leftHanded = lib.mkOption {
|
|
|
|
|
type = lib.types.bool;
|
2016-01-13 09:27:02 +01:00
|
|
|
|
default = false;
|
2016-01-22 11:46:02 +01:00
|
|
|
|
description = "Enables left-handed button orientation, i.e. swapping left and right buttons.";
|
2016-01-13 09:27:02 +01:00
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
middleEmulation = lib.mkOption {
|
|
|
|
|
type = lib.types.bool;
|
2015-09-18 17:29:10 +02:00
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
2016-01-22 11:46:02 +01:00
|
|
|
|
Enables middle button emulation. When enabled, pressing the left and right buttons
|
|
|
|
|
simultaneously produces a middle mouse button click.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2017-10-09 12:07:19 -07:00
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
naturalScrolling = lib.mkOption {
|
|
|
|
|
type = lib.types.bool;
|
2016-01-22 11:46:02 +01:00
|
|
|
|
default = false;
|
|
|
|
|
description = "Enables or disables natural scrolling behavior.";
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
scrollButton = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr lib.types.int;
|
2016-01-22 11:46:02 +01:00
|
|
|
|
default = null;
|
|
|
|
|
example = 1;
|
|
|
|
|
description = ''
|
|
|
|
|
Designates a button as scroll button. If the ScrollMethod is button and the button is logically
|
|
|
|
|
held down, x/y axis movement is converted into scroll events.
|
2015-09-18 17:29:10 +02:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
scrollMethod = lib.mkOption {
|
|
|
|
|
type = lib.types.enum [
|
|
|
|
|
"twofinger"
|
|
|
|
|
"edge"
|
|
|
|
|
"button"
|
|
|
|
|
"none"
|
|
|
|
|
];
|
2016-01-13 09:27:02 +01:00
|
|
|
|
default = "twofinger";
|
|
|
|
|
example = "edge";
|
|
|
|
|
description = ''
|
2017-10-09 12:07:19 -07:00
|
|
|
|
Specify the scrolling method: `twofinger`, `edge`,
|
2019-10-21 12:46:01 +05:30
|
|
|
|
`button`, or `none`
|
2016-01-13 09:27:02 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
horizontalScrolling = lib.mkOption {
|
|
|
|
|
type = lib.types.bool;
|
2016-01-13 09:27:02 +01:00
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
2023-06-15 12:36:24 +02:00
|
|
|
|
Enables or disables horizontal scrolling. When disabled, this driver will discard any
|
|
|
|
|
horizontal scroll events from libinput. This does not disable horizontal scroll events
|
|
|
|
|
from libinput; it merely discards the horizontal axis from any scroll events.
|
2016-01-13 09:27:02 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
sendEventsMode = lib.mkOption {
|
|
|
|
|
type = lib.types.enum [
|
|
|
|
|
"disabled"
|
|
|
|
|
"enabled"
|
|
|
|
|
"disabled-on-external-mouse"
|
|
|
|
|
];
|
2016-01-22 11:46:02 +01:00
|
|
|
|
default = "enabled";
|
|
|
|
|
example = "disabled";
|
|
|
|
|
description = ''
|
2017-10-09 12:07:19 -07:00
|
|
|
|
Sets the send events mode to `disabled`, `enabled`,
|
|
|
|
|
or `disabled-on-external-mouse`
|
2016-01-22 11:46:02 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
tapping = lib.mkOption {
|
|
|
|
|
type = lib.types.bool;
|
2016-01-22 11:46:02 +01:00
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
Enables or disables tap-to-click behavior.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2016-01-13 09:27:02 +01:00
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
tappingButtonMap = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr (
|
|
|
|
|
lib.types.enum [
|
|
|
|
|
"lrm"
|
|
|
|
|
"lmr"
|
|
|
|
|
]
|
|
|
|
|
);
|
2022-10-03 20:13:43 +01:00
|
|
|
|
default = null;
|
|
|
|
|
description = ''
|
|
|
|
|
Set the button mapping for 1/2/3-finger taps to left/right/middle or left/middle/right, respectively.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
tappingDragLock = lib.mkOption {
|
|
|
|
|
type = lib.types.bool;
|
2015-09-18 17:29:10 +02:00
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
Enables or disables drag lock during tapping behavior. When enabled, a finger up during tap-
|
|
|
|
|
and-drag will not immediately release the button. If the finger is set down again within the
|
2022-12-17 19:31:14 -05:00
|
|
|
|
timeout, the dragging process continues.
|
2015-09-18 17:29:10 +02:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
transformationMatrix = lib.mkOption {
|
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
2021-09-07 15:55:01 +00:00
|
|
|
|
default = null;
|
2021-11-15 08:37:26 -03:00
|
|
|
|
example = "0.5 0 0 0 0.8 0.1 0 0 1";
|
2021-09-07 15:55:01 +00:00
|
|
|
|
description = ''
|
2021-11-15 08:37:26 -03:00
|
|
|
|
A string of 9 space-separated floating point numbers. Sets the transformation matrix to
|
2021-09-07 15:55:01 +00:00
|
|
|
|
the 3x3 matrix where the first row is (abc), the second row is (def) and the third row is (ghi).
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
disableWhileTyping = lib.mkOption {
|
|
|
|
|
type = lib.types.bool;
|
2017-12-30 22:02:16 +00:00
|
|
|
|
default = false;
|
2016-01-22 11:46:02 +01:00
|
|
|
|
description = ''
|
|
|
|
|
Disable input method while typing.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2015-09-18 17:29:10 +02:00
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
additionalOptions = lib.mkOption {
|
|
|
|
|
type = lib.types.lines;
|
2015-09-18 17:29:10 +02:00
|
|
|
|
default = "";
|
2016-01-22 11:46:02 +01:00
|
|
|
|
example = ''
|
|
|
|
|
Option "DragLockButtons" "L1 B1 L2 B2"
|
2015-09-18 17:29:10 +02:00
|
|
|
|
'';
|
2020-04-14 14:31:49 +02:00
|
|
|
|
description = ''
|
2021-01-10 00:46:13 -03:00
|
|
|
|
Additional options for libinput ${deviceType} driver. See
|
2020-04-14 14:31:49 +02:00
|
|
|
|
{manpage}`libinput(4)`
|
|
|
|
|
for available options.";
|
|
|
|
|
'';
|
2015-09-18 17:29:10 +02:00
|
|
|
|
};
|
2024-12-10 20:26:33 +01:00
|
|
|
|
};
|
2015-09-18 17:29:10 +02:00
|
|
|
|
|
2021-01-10 00:46:13 -03:00
|
|
|
|
mkX11ConfigForDevice = deviceType: matchIs: ''
|
2021-06-17 03:15:13 +02:00
|
|
|
|
Identifier "libinput ${deviceType} configuration"
|
|
|
|
|
MatchDriver "libinput"
|
|
|
|
|
MatchIs${matchIs} "${xorgBool true}"
|
2024-08-27 20:43:20 +02:00
|
|
|
|
${lib.optionalString (cfg.${deviceType}.dev != null) ''MatchDevicePath "${cfg.${deviceType}.dev}"''}
|
2021-06-17 03:15:13 +02:00
|
|
|
|
Option "AccelProfile" "${cfg.${deviceType}.accelProfile}"
|
2024-08-27 20:43:20 +02:00
|
|
|
|
${lib.optionalString (
|
|
|
|
|
cfg.${deviceType}.accelSpeed != null
|
|
|
|
|
) ''Option "AccelSpeed" "${cfg.${deviceType}.accelSpeed}"''}
|
|
|
|
|
${lib.optionalString (
|
|
|
|
|
cfg.${deviceType}.accelPointsFallback != null
|
|
|
|
|
) ''Option "AccelPointsFallback" "${toString cfg.${deviceType}.accelPointsFallback}"''}
|
|
|
|
|
${lib.optionalString (cfg.${deviceType}.accelPointsMotion != null)
|
|
|
|
|
''Option "AccelPointsMotion" "${toString cfg.${deviceType}.accelPointsMotion}"''
|
|
|
|
|
}
|
|
|
|
|
${lib.optionalString (cfg.${deviceType}.accelPointsScroll != null)
|
|
|
|
|
''Option "AccelPointsScroll" "${toString cfg.${deviceType}.accelPointsScroll}"''
|
|
|
|
|
}
|
|
|
|
|
${lib.optionalString (cfg.${deviceType}.accelStepFallback != null)
|
|
|
|
|
''Option "AccelStepFallback" "${toString cfg.${deviceType}.accelStepFallback}"''
|
|
|
|
|
}
|
|
|
|
|
${lib.optionalString (cfg.${deviceType}.accelStepMotion != null)
|
|
|
|
|
''Option "AccelStepMotion" "${toString cfg.${deviceType}.accelStepMotion}"''
|
|
|
|
|
}
|
|
|
|
|
${lib.optionalString (cfg.${deviceType}.accelStepScroll != null)
|
|
|
|
|
''Option "AccelStepScroll" "${toString cfg.${deviceType}.accelStepScroll}"''
|
|
|
|
|
}
|
|
|
|
|
${lib.optionalString (cfg.${deviceType}.buttonMapping != null)
|
|
|
|
|
''Option "ButtonMapping" "${cfg.${deviceType}.buttonMapping}"''
|
|
|
|
|
}
|
|
|
|
|
${lib.optionalString (cfg.${deviceType}.calibrationMatrix != null)
|
|
|
|
|
''Option "CalibrationMatrix" "${cfg.${deviceType}.calibrationMatrix}"''
|
2024-12-10 20:26:33 +01:00
|
|
|
|
}
|
2024-08-27 20:43:20 +02:00
|
|
|
|
${lib.optionalString (
|
|
|
|
|
cfg.${deviceType}.transformationMatrix != null
|
|
|
|
|
) ''Option "TransformationMatrix" "${cfg.${deviceType}.transformationMatrix}"''}
|
|
|
|
|
${lib.optionalString (
|
|
|
|
|
cfg.${deviceType}.clickMethod != null
|
|
|
|
|
) ''Option "ClickMethod" "${cfg.${deviceType}.clickMethod}"''}
|
2021-06-17 03:15:13 +02:00
|
|
|
|
Option "LeftHanded" "${xorgBool cfg.${deviceType}.leftHanded}"
|
|
|
|
|
Option "MiddleEmulation" "${xorgBool cfg.${deviceType}.middleEmulation}"
|
|
|
|
|
Option "NaturalScrolling" "${xorgBool cfg.${deviceType}.naturalScrolling}"
|
2024-08-27 20:43:20 +02:00
|
|
|
|
${lib.optionalString (cfg.${deviceType}.scrollButton != null)
|
|
|
|
|
''Option "ScrollButton" "${toString cfg.${deviceType}.scrollButton}"''
|
|
|
|
|
}
|
2021-06-17 03:15:13 +02:00
|
|
|
|
Option "ScrollMethod" "${cfg.${deviceType}.scrollMethod}"
|
|
|
|
|
Option "HorizontalScrolling" "${xorgBool cfg.${deviceType}.horizontalScrolling}"
|
|
|
|
|
Option "SendEventsMode" "${cfg.${deviceType}.sendEventsMode}"
|
|
|
|
|
Option "Tapping" "${xorgBool cfg.${deviceType}.tapping}"
|
2024-08-27 20:43:20 +02:00
|
|
|
|
${lib.optionalString (cfg.${deviceType}.tappingButtonMap != null)
|
|
|
|
|
''Option "TappingButtonMap" "${cfg.${deviceType}.tappingButtonMap}"''
|
|
|
|
|
}
|
2021-06-17 03:15:13 +02:00
|
|
|
|
Option "TappingDragLock" "${xorgBool cfg.${deviceType}.tappingDragLock}"
|
|
|
|
|
Option "DisableWhileTyping" "${xorgBool cfg.${deviceType}.disableWhileTyping}"
|
|
|
|
|
${cfg.${deviceType}.additionalOptions}
|
|
|
|
|
'';
|
2021-01-10 00:46:13 -03:00
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
imports =
|
2024-08-27 20:43:20 +02:00
|
|
|
|
(map
|
|
|
|
|
(
|
|
|
|
|
option:
|
|
|
|
|
lib.mkRenamedOptionModule
|
|
|
|
|
([
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"libinput"
|
|
|
|
|
option
|
|
|
|
|
])
|
|
|
|
|
[
|
|
|
|
|
"services"
|
|
|
|
|
"libinput"
|
|
|
|
|
"touchpad"
|
|
|
|
|
option
|
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
[
|
2021-01-10 00:46:13 -03:00
|
|
|
|
"accelProfile"
|
|
|
|
|
"accelSpeed"
|
|
|
|
|
"buttonMapping"
|
|
|
|
|
"calibrationMatrix"
|
|
|
|
|
"clickMethod"
|
|
|
|
|
"leftHanded"
|
|
|
|
|
"middleEmulation"
|
|
|
|
|
"naturalScrolling"
|
|
|
|
|
"scrollButton"
|
|
|
|
|
"scrollMethod"
|
|
|
|
|
"horizontalScrolling"
|
|
|
|
|
"sendEventsMode"
|
|
|
|
|
"tapping"
|
2022-10-03 20:13:43 +01:00
|
|
|
|
"tappingButtonMap"
|
2021-01-21 19:52:57 -03:00
|
|
|
|
"tappingDragLock"
|
2021-09-07 15:55:01 +00:00
|
|
|
|
"transformationMatrix"
|
2021-01-10 00:46:13 -03:00
|
|
|
|
"disableWhileTyping"
|
|
|
|
|
"additionalOptions"
|
2024-04-17 22:55:18 +02:00
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
++ [
|
2024-08-27 20:43:20 +02:00
|
|
|
|
(lib.mkRenamedOptionModule
|
|
|
|
|
[ "services" "xserver" "libinput" "enable" ]
|
|
|
|
|
[ "services" "libinput" "enable" ]
|
|
|
|
|
)
|
|
|
|
|
(lib.mkRenamedOptionModule
|
|
|
|
|
[ "services" "xserver" "libinput" "mouse" ]
|
|
|
|
|
[ "services" "libinput" "mouse" ]
|
|
|
|
|
)
|
|
|
|
|
(lib.mkRenamedOptionModule
|
|
|
|
|
[ "services" "xserver" "libinput" "touchpad" ]
|
|
|
|
|
[ "services" "libinput" "touchpad" ]
|
|
|
|
|
)
|
2024-04-17 22:55:18 +02:00
|
|
|
|
];
|
2021-01-10 00:46:13 -03:00
|
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
2024-04-17 22:55:18 +02:00
|
|
|
|
services.libinput = {
|
2024-08-27 20:43:20 +02:00
|
|
|
|
enable = lib.mkEnableOption "libinput" // {
|
2023-05-18 13:58:18 +03:00
|
|
|
|
default = config.services.xserver.enable;
|
|
|
|
|
defaultText = lib.literalExpression "config.services.xserver.enable";
|
2023-05-11 16:42:07 +03:00
|
|
|
|
};
|
2021-01-10 00:46:13 -03:00
|
|
|
|
mouse = mkConfigForDevice "mouse";
|
|
|
|
|
touchpad = mkConfigForDevice "touchpad";
|
|
|
|
|
};
|
2015-09-18 17:29:10 +02:00
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 20:43:20 +02:00
|
|
|
|
config = lib.mkIf cfg.enable {
|
2015-09-18 17:29:10 +02:00
|
|
|
|
|
|
|
|
|
services.xserver.modules = [ pkgs.xorg.xf86inputlibinput ];
|
|
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.xorg.xf86inputlibinput ];
|
|
|
|
|
|
2019-09-14 19:51:29 +02:00
|
|
|
|
environment.etc =
|
|
|
|
|
let
|
|
|
|
|
cfgPath = "X11/xorg.conf.d/40-libinput.conf";
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
${cfgPath} = {
|
|
|
|
|
source = pkgs.xorg.xf86inputlibinput.out + "/share/" + cfgPath;
|
|
|
|
|
};
|
|
|
|
|
};
|
2017-11-24 00:25:54 +01:00
|
|
|
|
|
2018-08-30 15:27:26 +02:00
|
|
|
|
services.udev.packages = [ pkgs.libinput.out ];
|
2016-07-18 15:27:08 +03:00
|
|
|
|
|
2021-01-10 00:46:13 -03:00
|
|
|
|
services.xserver.inputClassSections = [
|
|
|
|
|
(mkX11ConfigForDevice "mouse" "Pointer")
|
|
|
|
|
(mkX11ConfigForDevice "touchpad" "Touchpad")
|
|
|
|
|
];
|
2015-09-18 17:29:10 +02:00
|
|
|
|
|
2016-08-03 08:15:18 +02:00
|
|
|
|
assertions = [
|
|
|
|
|
# already present in synaptics.nix
|
|
|
|
|
/*
|
|
|
|
|
{
|
|
|
|
|
assertion = !config.services.xserver.synaptics.enable;
|
|
|
|
|
message = "Synaptics and libinput are incompatible, you cannot enable both (in services.xserver).";
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
];
|
|
|
|
|
|
2015-09-18 17:29:10 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|