palm.strive

arch中小红点/触摸板驱动调整

在Arch中,小红点(TrackPoint)支持驱动有两个 – xf86-input-evdevxf86-input-libinput 都支持它。evdev是 Xorg 的默认驱动。从2017-01-14起,xf86-input-libinput作为默认驱动,但是依然支持synaptics, evdev驱动配置. 如果因为升级导致支持驱动自动变为libinput,则可以重新安装evdev驱动然后调整配置文件还原回来.我就是这样的,因为,我考虑到毕竟libinput刚出来可能不是很稳定,再者,之前都是针对evdev的配置,所以不想又挨个儿修改配置,于是继续使用evden作为小红点的配置.

安装驱动xf86-input-evdev

首先,安装xf86-input-evdev驱动后,默认在/usr/share/X11/xorg.conf.d下有一个配置文件 - 10-evdev.conf,大概内容如下:

#
# Catch-all evdev loader for udev-based systems
# We don't simply match on any device since that also adds accelerometers
# and other devices that we don't really want to use. The list below
# matches everything but joysticks.

Section "InputClass"
        Identifier "evdev pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "evdev keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "evdev touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "evdev tablet catchall"
        MatchIsTablet "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

Section "InputClass"
        Identifier "evdev touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection

将这个文件copy到/etc/X11/xorg.conf.d/下,然后结合synaptics驱动一起控制触摸板[TouchPad]

安装驱动xf86-input-synaptics

同样,安装xf86-input-synaptics后其默认配置文件(70-synaptics.conf)在`/usr/share/X11/xorg.conf.d/`下, 我们需要将这个配置文件移动到/etc/X11/xorg.conf.d/目录下,然后才可以生效,内容类似这样:
/etc/X11/xorg.conf.d/70-synaptics.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Section "InputClass"
Identifier "touchpad"
Driver "synaptics"
MatchIsTouchpad "on"
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "VertEdgeScroll" "on"
Option "VertTwoFingerScroll" "on"
Option "HorizEdgeScroll" "on"
Option "HorizTwoFingerScroll" "on"
Option "CircularScrolling" "on"
Option "CircScrollTrigger" "2"
Option "EmulateTwoFingerMinZ" "40"
Option "EmulateTwoFingerMinW" "8"
Option "CoastingSpeed" "0"
Option "FingerLow" "30"
Option "FingerHigh" "50"
Option "MaxTapTime" "125"
...
EndSection

详细配置可以在ArchWiki#Touchpad_Synaptics查看.我的配置如下:
/etc/X11/xorg.conf.d/70-synaptics.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Example xorg.conf.d snippet that assigns the touchpad driver
# to all touchpads. See xorg.conf.d(5) for more information on
# InputClass.
# DO NOT EDIT THIS FILE, your distribution will likely overwrite
# it when updating. Copy (and rename) this file into
# /etc/X11/xorg.conf.d first.
# Additional options may be added in the form of
# Option "OptionName" "value"
#
Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
MatchIsTouchpad "on"
# This option is recommend on all Linux systems using evdev, but cannot be
# enabled by default. See the following link for details:
# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
MatchDevicePath "/dev/input/event*"
EndSection
Section "InputClass"
Identifier "touchpad ignore duplicates"
MatchIsTouchpad "on"
MatchOS "Linux"
MatchDevicePath "/dev/input/mouse*"
Option "Ignore" "on"
EndSection
# This option enables the bottom right corner to be a right button on clickpads
# and the right and middle top areas to be right / middle buttons on clickpads
# with a top button area.
# This option is only interpreted by clickpads.
Section "InputClass"
Identifier "Default clickpad buttons"
MatchDriver "synaptics"
Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
Option "SecondarySoftButtonAreas" "58% 0 0 15% 42% 58% 0 15%"
EndSection
# This option disables software buttons on Apple touchpads.
# This option is only interpreted by clickpads.
Section "InputClass"
Identifier "Disable clickpad buttons on Apple touchpads"
MatchProduct "Apple|bcm5974"
MatchDriver "synaptics"
Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
EndSection
Section "InputClass"
Identifier "TPPS/2 IBM TrackPoint"
MatchProduct "TPPS/2 IBM TrackPoint"
MatchDriver "synaptics"
Option "Device" "/dev/input/event*"
Option "Protocol" "auto-dev"
Option "TapButton1" "0"
Option "TapButton2" "0"
Option "LeftEdge" "1700"
Option "RightEdge" "5300"
Option "TopEdge" "1700"
Option "BottomEdge" "4200"
Option "FingerLow" "25"
Option "FingerHigh" "30"
Option "MaxTapTime" "180"
Option "MaxTapMove" "420" #该值过小无法抓住文件窗口
Option "MinSpeed" "0.7" #该值越大指针移动快(>1的和1相等)
Option "MaxSpeed" "0.95" #该值越大指针移动快(>1的和1相等)
Option "AccelFactor" "0.0010"
Option "RTCornerButton""2" #让触摸板 右侧顶部 表示鼠标中键
Option "RBCornerButton""3" #让触摸板 右侧底部 表示鼠标右键
Option "VertEdgeScroll""1" #启用垂直滚动条
Option "VertScrollDelta""100" #该值越小滚动条滚动越快
Option "HorizEdgeScroll""1"#启用水平滚动条
Option "CornerCoasting" "1"#如果手指滑动到最边界是否屏幕继续滚动
Option "SHMConfig" "on"
Option "TouchpadOff" "1"
EndSection

配置头,例如MatchProduct 可以使用 xinput命令查看,xinput list查看touchpad设备名称.如:

$ xinput list
Virtual core pointer                        id=2    [master pointer  (3)]
Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
    MLK rapoo 3900                              id=10    [slave  pointer  (2)]
    SynPS/2 Synaptics TouchPad                  id=13    [slave  pointer  (2)]
    TPPS/2 IBM TrackPoint                       id=14    [slave  pointer  (2)]
Virtual core keyboard                       id=3    [master keyboard (2)]
  Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
  Power Button                                id=6    [slave  keyboard (3)]
  Video Bus                                   id=7    [slave  keyboard (3)]
  Video Bus                                   id=8    [slave  keyboard (3)]
  Sleep Button                                id=9    [slave  keyboard (3)]
  Integrated Camera                           id=11    [slave  keyboard (3)]
  AT Translated Set 2 keyboard                id=12    [slave  keyboard (3)]
  ThinkPad Extra Buttons                      id=15    [slave  keyboard (3)]

然后, 如果你使用gnome-shell则,可以安装gnome扩展 -TouchpadIndicator, 它可以通过GUI禁用触摸板.一般的,有了小红点触摸板基本就不用了.当然Synaptics提供了丰富的触摸板个性化配置,
例如,类似Mac触摸板(号称世界上比鼠标还好用的触摸板体验)自然滚动,画圆滚动,打字自动禁用触摸板等等.
随便你配置,但是,假设Mac触摸板的说法是事实(因为我没有体验过),我想非Mac机器上配置触摸板应该达不到Mac那种效果,所以还是以实用为主.其实,在我的世界里,小红点才是世界上最优的鼠标替代者!尤其是对字符编辑者来说尤其是.想想你的双手可以不用键盘鼠标来回的移动.