2009-09-10 13:37:33 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
let cfg = config.services.xserver.synaptics; in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.xserver.synaptics = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = "Whether to enable touchpad support.";
|
|
|
|
};
|
|
|
|
|
|
|
|
dev = mkOption {
|
2010-08-10 15:13:57 +01:00
|
|
|
default = null;
|
2012-01-10 18:40:02 +00:00
|
|
|
example = "/dev/input/event0";
|
2011-09-14 19:20:50 +01:00
|
|
|
description =
|
2010-08-10 15:13:57 +01:00
|
|
|
''
|
|
|
|
Path for touchpad device. Set to null to apply to any
|
|
|
|
auto-detected touchpad.
|
|
|
|
'';
|
2009-09-10 13:37:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
minSpeed = mkOption {
|
2010-08-02 20:06:42 +01:00
|
|
|
default = "0.6";
|
2009-09-10 13:37:33 +01:00
|
|
|
description = "Cursor speed factor for precision finger motion.";
|
|
|
|
};
|
|
|
|
|
|
|
|
maxSpeed = mkOption {
|
2010-08-02 20:06:42 +01:00
|
|
|
default = "1.0";
|
2009-09-10 13:37:33 +01:00
|
|
|
description = "Cursor speed factor for highest-speed finger motion.";
|
|
|
|
};
|
|
|
|
|
|
|
|
twoFingerScroll = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable two-finger drag-scrolling.";
|
|
|
|
};
|
|
|
|
|
2010-08-02 20:06:42 +01:00
|
|
|
vertEdgeScroll = mkOption {
|
2011-08-10 23:14:46 +01:00
|
|
|
default = ! cfg.twoFingerScroll;
|
2010-08-02 20:06:42 +01:00
|
|
|
description = "Whether to enable vertical edge drag-scrolling.";
|
|
|
|
};
|
|
|
|
|
2012-01-13 22:23:18 +00:00
|
|
|
tapButtons = mkOption {
|
|
|
|
default = true;
|
2012-01-14 12:24:41 +00:00
|
|
|
example = false;
|
2012-01-13 22:23:18 +00:00
|
|
|
description = "Whether to enable tap buttons.";
|
|
|
|
};
|
|
|
|
|
|
|
|
palmDetect = mkOption {
|
2012-01-14 09:40:08 +00:00
|
|
|
default = false;
|
2012-01-14 12:24:41 +00:00
|
|
|
example = true;
|
2012-01-13 22:23:18 +00:00
|
|
|
description = "Whether to enable palm detection (hardware support required)";
|
|
|
|
};
|
|
|
|
|
2012-04-19 09:29:22 +01:00
|
|
|
horizontalScroll = mkOption {
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
description = "Whether to enable horizontal scrolling (on touchpad)";
|
|
|
|
};
|
|
|
|
|
2012-01-10 18:40:02 +00:00
|
|
|
additionalOptions = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = ''
|
|
|
|
Option "RTCornerButton" "2"
|
|
|
|
Option "RBCornerButton" "3"
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
Additional options for synaptics touchpad driver.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
services.xserver.modules = [ pkgs.xorg.xf86inputsynaptics ];
|
|
|
|
|
|
|
|
services.xserver.config =
|
|
|
|
''
|
2010-08-10 15:13:57 +01:00
|
|
|
# Automatically enable the synaptics driver for all touchpads.
|
|
|
|
Section "InputClass"
|
2010-09-03 20:10:45 +01:00
|
|
|
Identifier "synaptics touchpad catchall"
|
2010-08-10 15:13:57 +01:00
|
|
|
MatchIsTouchpad "on"
|
|
|
|
${optionalString (cfg.dev != null) ''MatchDevicePath "${cfg.dev}"''}
|
2010-09-03 20:10:45 +01:00
|
|
|
Driver "synaptics"
|
2009-09-10 13:37:33 +01:00
|
|
|
Option "MaxTapTime" "180"
|
|
|
|
Option "MaxTapMove" "220"
|
|
|
|
Option "MinSpeed" "${cfg.minSpeed}"
|
|
|
|
Option "MaxSpeed" "${cfg.maxSpeed}"
|
|
|
|
Option "AccelFactor" "0.0010"
|
2012-01-13 22:23:18 +00:00
|
|
|
Option "TapButton1" "${if cfg.tapButtons then "1" else "0"}"
|
|
|
|
Option "TapButton2" "${if cfg.tapButtons then "2" else "0"}"
|
|
|
|
Option "TapButton3" "${if cfg.tapButtons then "3" else "0"}"
|
2012-04-19 09:29:22 +01:00
|
|
|
${if cfg.tapButtons then "" else ''Option "MaxTapTime" "0"''}
|
2009-09-10 13:37:33 +01:00
|
|
|
Option "VertTwoFingerScroll" "${if cfg.twoFingerScroll then "1" else "0"}"
|
|
|
|
Option "HorizTwoFingerScroll" "${if cfg.twoFingerScroll then "1" else "0"}"
|
2010-08-02 20:06:42 +01:00
|
|
|
Option "VertEdgeScroll" "${if cfg.vertEdgeScroll then "1" else "0"}"
|
2012-01-13 22:23:18 +00:00
|
|
|
${if cfg.palmDetect then ''Option "PalmDetect" "1"'' else ""}
|
2012-04-19 09:29:22 +01:00
|
|
|
${if cfg.horizontalScroll then "" else ''Option "HorizScrollDelta" "0"''}
|
2012-01-10 18:40:02 +00:00
|
|
|
${cfg.additionalOptions}
|
2009-09-10 13:37:33 +01:00
|
|
|
EndSection
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|