summary refs log tree commit diff
diff options
context:
space:
mode:
authorBoris Babic <boris.ivan.babic@gmail.com>2018-07-24 18:11:56 +0200
committerBoris Babic <boris.ivan.babic@gmail.com>2018-08-06 02:56:32 +0200
commit0ef3119c69532d783c38b22e90649b0922cfd307 (patch)
tree35e23dc39b7520350d7fbda82e418af1d202a577
parent2428f5dda13475afba2dee93f4beb2bd97086930 (diff)
downloadnixpkgs-0ef3119c69532d783c38b22e90649b0922cfd307.tar
nixpkgs-0ef3119c69532d783c38b22e90649b0922cfd307.tar.gz
nixpkgs-0ef3119c69532d783c38b22e90649b0922cfd307.tar.bz2
nixpkgs-0ef3119c69532d783c38b22e90649b0922cfd307.tar.lz
nixpkgs-0ef3119c69532d783c38b22e90649b0922cfd307.tar.xz
nixpkgs-0ef3119c69532d783c38b22e90649b0922cfd307.tar.zst
nixpkgs-0ef3119c69532d783c38b22e90649b0922cfd307.zip
trackpoint: Make the device name configurable
-rw-r--r--nixos/modules/tasks/trackpoint.nix15
1 files changed, 12 insertions, 3 deletions
diff --git a/nixos/modules/tasks/trackpoint.nix b/nixos/modules/tasks/trackpoint.nix
index 3575a291b2b..b154cf9f5f0 100644
--- a/nixos/modules/tasks/trackpoint.nix
+++ b/nixos/modules/tasks/trackpoint.nix
@@ -55,6 +55,15 @@ with lib;
         '';
       };
 
+      device = mkOption {
+        default = "TPPS/2 IBM TrackPoint";
+        type = types.str;
+        description = ''
+          The device name of the trackpoint. You can check with xinput.
+          Some newer devices (example x1c6) use "TPPS/2 Elan TrackPoint".
+        '';
+      };
+
     };
 
   };
@@ -68,12 +77,12 @@ with lib;
     (mkIf cfg.enable {
       services.udev.extraRules =
       ''
-        ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString cfg.speed}", ATTR{device/sensitivity}="${toString cfg.sensitivity}"
+        ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="${cfg.device}", ATTR{device/speed}="${toString cfg.speed}", ATTR{device/sensitivity}="${toString cfg.sensitivity}"
       '';
 
       system.activationScripts.trackpoint =
         ''
-          ${config.systemd.package}/bin/udevadm trigger --attr-match=name="TPPS/2 IBM TrackPoint"
+          ${config.systemd.package}/bin/udevadm trigger --attr-match=name="${cfg.device}"
         '';
     })
 
@@ -81,7 +90,7 @@ with lib;
       services.xserver.inputClassSections =
         [''
         Identifier "Trackpoint Wheel Emulation"
-          MatchProduct "${if cfg.fakeButtons then "PS/2 Generic Mouse" else "ETPS/2 Elantech TrackPoint|Elantech PS/2 TrackPoint|TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"}"
+          MatchProduct "${if cfg.fakeButtons then "PS/2 Generic Mouse" else "ETPS/2 Elantech TrackPoint|Elantech PS/2 TrackPoint|TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint|${cfg.device}"}"
           MatchDevicePath "/dev/input/event*"
           Option "EmulateWheel" "true"
           Option "EmulateWheelButton" "2"