如何配置Trackpoint,以便中键滚动不被误解为中键粘贴?

我正在使用一款Thinkpad USB Trackpoint键盘,当我尝试使用中键和Trackpoint滚动时,有时会执行中键粘贴操作。我不记得在我的笔记本电脑上的内置键盘上曾经发生过这种情况。
有没有办法配置中间的“鼠标”按钮,以便它不会将中键滚动误解为中键粘贴?
注意: 我不想禁用中间的鼠标按钮。我希望能够进行滚动。
2个回答

这里是Ubuntu Wiki上关于如何禁用鼠标中键的条目。 这个方法适用于使用X系统的任何系统。

Example: Disabling middle-mouse button paste on a scrollwheel mouse

Scrollwheel mice support a middle-button click event when pressing the scrollwheel. This is a great feature, but you may find it irritating. Fortunately it can be disabled.

First, you need to know the id of the mouse, like this:

$ xinput list | grep 'id='

"Virtual core pointer"  id=0    [XPointer]
"Virtual core keyboard" id=1    [XKeyboard]
"AT Translated Set 2 keyboard"  id=2    [XExtensionKeyboard]
"Macintosh mouse button emulation"      id=3    [XExtensionPointer]
"Logitech USB-PS/2 Optical Mouse"       id=4    [XExtensionPointer]

My mouse has the Logitech logo printed on it, so I gather I need the last entry.

I can view the current button mapping thusly:

$ xinput get-button-map 4

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 10

Really, only the first three numbers have meaning for me. They represent the left, middle, and right mouse buttons.

$ xinput get-button-map 4

I can turn the middle mouse button off by setting it to 0:

$ xinput set-button-map 4 1 0 3

Or I can turn the middle-mouse button into a left-mouse button by setting it to 1:

$ xinput set-button-map 4 1 1 3

To make this set on a per-user basis, I can plug that line into my ~/.xstartup or other init file. It can also be done via configuring a matching InputClass section on xorg.conf.

上面的例子并没有禁用滚动;如果你想要禁用滚动,请参考这里

我不想禁用中键。我希望能够滚动。 - jumpnett
中间的鼠标按钮是指那个不用来滚动的按钮。试一试,看看它是否有效。如果你仔细看了示例,就会发现有超过25种不同的输入动作,滚动功能是按不同方式注册的。试一试吧。 - West
可能是误解了。我会试一下的。 :) - jumpnett
太好了,成功了。 - jumpnett
请改进这个答案并在答案中提供方法。我想解决这个问题,但链接没有提供帮助。谢谢。 - MountainX
@MountainX 我现在一般是这样做的。首先使用xinput --list来找到轨迹指针的id(比如说id=10),然后执行xinput --set-button-map 10 1 0 3来禁用它。如果你想重新启用它,执行xinput --set-button-map 10 1 2 3即可。不过这样做会导致在火狐浏览器中无法保留中键点击以打开新标签页。 - jumpnett
@jumpnett:谢谢,我尝试了那个方法,但没有成功。你能想到为什么那个方法不起作用吗?(xorg.conf的方法确实有效,但已经相对过时了。) - MountainX
@MountainX 不确定 - jumpnett
上述示例不会禁用滚动,这在维基百科上没有提到,真是可惜。我认为这会让很多遇到这个(确实令人沮丧)问题的轨迹球鼠标用户感到困惑。我不使用Ubuntu,所以我不想创建一个帐户并编辑维基百科来修复这个问题。 - user114791
@jumpnett 你有没有找到在Firefox中保留“在新标签页打开”的功能? - Prunus Persica
1@PrunusPersica 我目前的安装没有这个问题,所以我已经有一年左右没有处理过这个了。我不记得曾经解决过这个问题。很抱歉我无法提供任何帮助。 - jumpnett

在Ubuntu 17和XFCE中,中鼠标键复制粘贴根本无法使用。Fedora 26 XFCE也是同样的情况,解决方法如下:

解决方案

要启用中鼠标键粘贴功能,请编辑xinput。

  1. 查询设备以识别鼠标(我的设备编号为10):

    xinput list
    
  2. 列出鼠标设置:

    xinput list-props <your_mouse_device_number>
    
  3. 更改“libinput Middle Emulation Enabled (294)”的值(作为root用户):

    sudo xinput set-prop 10 "libinput Middle Emulation Enabled" 1
    
  4. 检查值是否已更改为1:

    xinput list-props 10
    
输出应该是libinput Middle Emulation Enabled (294): 1 非常非常感谢 Gilles(https://unix.stackexchange.com/users/885/gilles)找到了解决方案!
阅读更多:https://wiki.ubuntu.com/X/Config/Input