有没有办法配置中间的“鼠标”按钮,以便它不会将中键滚动误解为中键粘贴?
注意: 我不想禁用中间的鼠标按钮。我希望能够进行滚动。
这里是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.
在Ubuntu 17和XFCE中,中鼠标键复制粘贴根本无法使用。Fedora 26 XFCE也是同样的情况,解决方法如下:
要启用中鼠标键粘贴功能,请编辑xinput。
查询设备以识别鼠标(我的设备编号为10):
xinput list
列出鼠标设置:
xinput list-props <your_mouse_device_number>
更改“libinput Middle Emulation Enabled (294)”的值(作为root用户):
sudo xinput set-prop 10 "libinput Middle Emulation Enabled" 1
检查值是否已更改为1:
xinput list-props 10
libinput Middle Emulation Enabled (294): 1
非常非常感谢 Gilles(https://unix.stackexchange.com/users/885/gilles)找到了解决方案!
xinput --list
来找到轨迹指针的id(比如说id=10),然后执行xinput --set-button-map 10 1 0 3
来禁用它。如果你想重新启用它,执行xinput --set-button-map 10 1 2 3
即可。不过这样做会导致在火狐浏览器中无法保留中键点击以打开新标签页。 - jumpnett