2023-09-13 17:40:57 +02:00
|
|
|
{
|
2023-10-10 02:28:07 +02:00
|
|
|
pkgs,
|
2023-09-26 22:25:58 +02:00
|
|
|
lib,
|
|
|
|
minimal,
|
2023-10-10 02:28:07 +02:00
|
|
|
config,
|
2023-09-26 22:25:58 +02:00
|
|
|
...
|
|
|
|
}:
|
|
|
|
lib.optionalAttrs (!minimal) {
|
2023-09-13 17:40:57 +02:00
|
|
|
# Configure keymap in X11
|
|
|
|
services.xserver = {
|
|
|
|
enable = true;
|
|
|
|
displayManager.startx.enable = true;
|
|
|
|
autoRepeatDelay = 235;
|
|
|
|
autoRepeatInterval = 60;
|
2024-07-26 22:12:48 +02:00
|
|
|
videoDrivers = [ "modesetting" ];
|
2024-05-13 23:10:47 +02:00
|
|
|
};
|
|
|
|
services.libinput = {
|
|
|
|
enable = true;
|
|
|
|
mouse = {
|
|
|
|
accelSpeed = "0.5";
|
|
|
|
accelProfile = "flat";
|
|
|
|
middleEmulation = false;
|
|
|
|
};
|
|
|
|
touchpad = {
|
|
|
|
accelProfile = "flat";
|
|
|
|
accelSpeed = "1";
|
|
|
|
naturalScrolling = true;
|
|
|
|
disableWhileTyping = true;
|
2023-09-13 17:40:57 +02:00
|
|
|
};
|
|
|
|
};
|
2024-07-26 22:12:48 +02:00
|
|
|
services.udev.extraRules =
|
|
|
|
let
|
|
|
|
exe = pkgs.writeShellScript "set-key-repeat" ''
|
2023-10-11 20:54:56 +02:00
|
|
|
if [ -d "/tmp/.X11-unix" ]; then
|
|
|
|
for D in /tmp/.X11-unix/*; do
|
|
|
|
file=$(${pkgs.coreutils}/bin/basename $D)
|
|
|
|
export DISPLAY=":''${file:1}"
|
|
|
|
user=$(${pkgs.coreutils}/bin/stat -c '%U' "$D")
|
|
|
|
# sleep to give X time to access the keyboard
|
|
|
|
(sleep 0.2; ${pkgs.util-linux}/bin/runuser -u "$user" -- ${pkgs.xorg.xset}/bin/xset r rate \
|
|
|
|
${toString config.services.xserver.autoRepeatDelay} ${toString config.services.xserver.autoRepeatInterval})&
|
|
|
|
done
|
|
|
|
fi
|
2023-10-10 02:28:07 +02:00
|
|
|
'';
|
2024-07-26 22:12:48 +02:00
|
|
|
in
|
|
|
|
''
|
|
|
|
ACTION=="add", SUBSYSTEM=="input", ATTRS{bInterfaceClass}=="03", RUN+="${exe}"
|
|
|
|
'';
|
2023-09-13 17:40:57 +02:00
|
|
|
}
|