about summary refs log tree commit diff
path: root/nixos/modules/services/x11/hardware
diff options
context:
space:
mode:
authorBrian McKenna <brian@simpleenergy.com>2015-02-14 14:56:08 -0700
committerBrian McKenna <brian@simpleenergy.com>2015-02-14 14:56:12 -0700
commit28a9ed618fd0ec26ca1425892498ae8f77a4b480 (patch)
treeb19ee49f79100211fc4dd22734927981e1faecc2 /nixos/modules/services/x11/hardware
parent795681d6f9c7aad42155fcbc6fe05e3de66a934c (diff)
downloadnixlib-28a9ed618fd0ec26ca1425892498ae8f77a4b480.tar
nixlib-28a9ed618fd0ec26ca1425892498ae8f77a4b480.tar.gz
nixlib-28a9ed618fd0ec26ca1425892498ae8f77a4b480.tar.bz2
nixlib-28a9ed618fd0ec26ca1425892498ae8f77a4b480.tar.lz
nixlib-28a9ed618fd0ec26ca1425892498ae8f77a4b480.tar.xz
nixlib-28a9ed618fd0ec26ca1425892498ae8f77a4b480.tar.zst
nixlib-28a9ed618fd0ec26ca1425892498ae8f77a4b480.zip
Add more options to multitouch (mtrack) module
Diffstat (limited to 'nixos/modules/services/x11/hardware')
-rw-r--r--nixos/modules/services/x11/hardware/multitouch.nix44
1 files changed, 41 insertions, 3 deletions
diff --git a/nixos/modules/services/x11/hardware/multitouch.nix b/nixos/modules/services/x11/hardware/multitouch.nix
index 6e6e88e67218..f8386b5e333b 100644
--- a/nixos/modules/services/x11/hardware/multitouch.nix
+++ b/nixos/modules/services/x11/hardware/multitouch.nix
@@ -2,9 +2,15 @@
 
 with lib;
 
-let cfg = config.services.xserver.multitouch; in
-
-{
+let cfg = config.services.xserver.multitouch;
+    disabledTapConfig = ''
+      Option "MaxTapTime" "0"
+      Option "MaxTapMove" "0"
+      Option "TapButton1" "0"
+      Option "TapButton2" "0"
+      Option "TapButton3" "0"
+    '';
+in {
 
   options = {
 
@@ -30,6 +36,33 @@ let cfg = config.services.xserver.multitouch; in
         description = "Whether to ignore touches detected as being the palm (i.e when typing)";
       };
 
+      tapButtons = mkOption {
+        type = types.bool;
+        default = true;
+        example = false;
+        description = "Whether to enable tap buttons.";
+      };
+
+      buttonsMap = mkOption {
+        type = types.listOf types.int;
+        default = [3 2 0];
+        example = [1 3 2];
+        description = "Remap touchpad buttons.";
+        apply = map toString;
+      };
+
+      additionalOptions = mkOption {
+        type = types.str;
+        default = "";
+        example = ''
+          Option "ScaleDistance" "50"
+          Option "RotateDistance" "60"
+        '';
+        description = ''
+          Additional options for mtrack touchpad driver.
+        '';
+      };
+
     };
 
   };
@@ -46,12 +79,17 @@ let cfg = config.services.xserver.multitouch; in
           Identifier "Touchpads"
           Driver "mtrack"
           Option "IgnorePalm" "${if cfg.ignorePalm then "true" else "false"}"
+          Option "ClickFinger1" "${builtins.elemAt cfg.buttonsMap 0}"
+          Option "ClickFinger2" "${builtins.elemAt cfg.buttonsMap 1}"
+          Option "ClickFinger3" "${builtins.elemAt cfg.buttonsMap 2}"
+          ${optionalString (!cfg.tapButtons) disabledTapConfig}
           ${optionalString cfg.invertScroll ''
             Option "ScrollUpButton" "5"
             Option "ScrollDownButton" "4"
             Option "ScrollLeftButton" "7"
             Option "ScrollRightButton" "6"
           ''}
+          ${cfg.additionalOptions}
         EndSection
       '';