2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2011-08-08 03:27:44 +02:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2011-08-08 03:27:44 +02:00
|
|
|
|
2015-02-14 22:56:08 +01:00
|
|
|
let cfg = config.services.xserver.multitouch;
|
|
|
|
disabledTapConfig = ''
|
|
|
|
Option "MaxTapTime" "0"
|
|
|
|
Option "MaxTapMove" "0"
|
|
|
|
Option "TapButton1" "0"
|
|
|
|
Option "TapButton2" "0"
|
|
|
|
Option "TapButton3" "0"
|
|
|
|
'';
|
|
|
|
in {
|
2011-08-08 03:27:44 +02:00
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2011-08-08 03:34:36 +02:00
|
|
|
services.xserver.multitouch = {
|
|
|
|
|
2011-08-08 03:27:44 +02:00
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
2011-08-08 03:34:36 +02:00
|
|
|
description = "Whether to enable multitouch touchpad support.";
|
2011-08-08 03:27:44 +02:00
|
|
|
};
|
|
|
|
|
2012-07-15 00:02:46 +02:00
|
|
|
invertScroll = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = "Whether to invert scrolling direction à la OSX Lion";
|
|
|
|
};
|
|
|
|
|
2012-07-15 03:40:49 +02:00
|
|
|
ignorePalm = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = "Whether to ignore touches detected as being the palm (i.e when typing)";
|
|
|
|
};
|
|
|
|
|
2015-02-14 22:56:08 +01:00
|
|
|
tapButtons = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2011-08-08 03:27:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2012-07-15 03:40:49 +02:00
|
|
|
config = mkIf cfg.enable {
|
2011-08-08 03:27:44 +02:00
|
|
|
|
2012-03-20 02:56:39 +01:00
|
|
|
services.xserver.modules = [ pkgs.xf86_input_mtrack ];
|
2011-08-08 03:27:44 +02:00
|
|
|
|
|
|
|
services.xserver.config =
|
|
|
|
''
|
2011-08-08 03:34:36 +02:00
|
|
|
# Automatically enable the multitouch driver
|
2011-08-08 03:27:44 +02:00
|
|
|
Section "InputClass"
|
2012-03-20 02:48:09 +01:00
|
|
|
MatchIsTouchpad "on"
|
|
|
|
Identifier "Touchpads"
|
|
|
|
Driver "mtrack"
|
2012-07-15 03:40:49 +02:00
|
|
|
Option "IgnorePalm" "${if cfg.ignorePalm then "true" else "false"}"
|
2015-02-14 22:56:08 +01:00
|
|
|
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}
|
2012-07-15 03:40:49 +02:00
|
|
|
${optionalString cfg.invertScroll ''
|
2012-07-15 00:02:46 +02:00
|
|
|
Option "ScrollUpButton" "5"
|
|
|
|
Option "ScrollDownButton" "4"
|
2012-07-16 14:03:47 +02:00
|
|
|
Option "ScrollLeftButton" "7"
|
2012-07-16 14:11:44 +02:00
|
|
|
Option "ScrollRightButton" "6"
|
2012-07-15 00:02:46 +02:00
|
|
|
''}
|
2015-02-14 22:56:08 +01:00
|
|
|
${cfg.additionalOptions}
|
2011-08-08 03:27:44 +02:00
|
|
|
EndSection
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|