about summary refs log tree commit diff
path: root/nixos/modules/tasks/trackpoint.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/tasks/trackpoint.nix')
-rw-r--r--nixos/modules/tasks/trackpoint.nix44
1 files changed, 34 insertions, 10 deletions
diff --git a/nixos/modules/tasks/trackpoint.nix b/nixos/modules/tasks/trackpoint.nix
index d1c6f8ac1565..5d1bb631b54f 100644
--- a/nixos/modules/tasks/trackpoint.nix
+++ b/nixos/modules/tasks/trackpoint.nix
@@ -36,6 +36,14 @@ with lib;
           configures 97.
         '';
       };
+
+      emulateWheel = mkOption {
+        default = false;
+        type = types.bool;
+        description = ''
+          Enable scrolling while holding the middle mouse button.
+        '';
+      };
       
     };
 
@@ -44,17 +52,33 @@ with lib;
 
   ###### implementation
 
-  config = mkIf config.hardware.trackpoint.enable {
-
-    services.udev.extraRules =
-    ''
-      ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString config.hardware.trackpoint.speed}", ATTR{device/sensitivity}="${toString config.hardware.trackpoint.sensitivity}"
-    '';
-
-    system.activationScripts.trackpoint =
+  config = mkMerge [
+    (mkIf config.hardware.trackpoint.enable {
+      services.udev.extraRules =
       ''
-        ${config.systemd.package}/bin/udevadm trigger --attr-match=name="TPPS/2 IBM TrackPoint"
+        ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString config.hardware.trackpoint.speed}", ATTR{device/sensitivity}="${toString config.hardware.trackpoint.sensitivity}"
       '';
-  };
 
+      system.activationScripts.trackpoint =
+        ''
+          ${config.systemd.package}/bin/udevadm trigger --attr-match=name="TPPS/2 IBM TrackPoint"
+        '';
+    })
+
+    (mkIf config.hardware.trackpoint.emulateWheel {
+      services.xserver.config =
+        ''
+          Section "InputClass"
+            Identifier "Trackpoint Wheel Emulation"
+            MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"
+            MatchDevicePath "/dev/input/event*"
+            Option "EmulateWheel" "true"
+            Option "EmulateWheelButton" "2"
+            Option "Emulate3Buttons" "false"
+            Option "XAxisMapping" "6 7"
+            Option "YAxisMapping" "4 5"
+            EndSection
+        '';
+    })
+  ];
 }