2011-08-08 03:27:44 +02:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
2012-07-15 03:40:49 +02:00
|
|
|
let cfg = config.services.xserver.multitouch; 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;
|
|
|
|
example = true;
|
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;
|
|
|
|
example = true;
|
|
|
|
type = types.bool;
|
|
|
|
description = "Whether to invert scrolling direction à la OSX Lion";
|
|
|
|
};
|
|
|
|
|
2012-07-15 03:40:49 +02:00
|
|
|
ignorePalm = mkOption {
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
type = types.bool;
|
|
|
|
description = "Whether to ignore touches detected as being the palm (i.e when typing)";
|
|
|
|
};
|
|
|
|
|
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"}"
|
|
|
|
${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
|
|
|
''}
|
2011-08-08 03:27:44 +02:00
|
|
|
EndSection
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|