我正在尝试将鼠标中键 B2 映射到鼠标左键 B1。我正在使用 xmodmap,我的理解是使用指针来更改它。
这是~/.Xmodmap
pointer = 1 1 3 4 5 6 7 8 9
但我收到此错误。有什么想法吗?
~$ xmodmap ~/.Xmodmap
Warning: Only changing the first 9 of 20 buttons.
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 116 (X_SetPointerMapping)
Value in failed request: 0x1
Serial number of failed request: 9
Current serial number in output stream: 9
这个 modmap 可以工作,但是按钮当然是反转的。 ~/.Xmodmap
pointer = 2 1 3 4 5 6 7 8 9
答案1
好吧没关系。我找到了一个使用 xinput 的更好的解决方案:
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech Wireless Mouse id=10 [slave pointer (2)]
⎜ ↳ MyMouse id=11 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [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)]
↳ Power Button id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
↳ MSI WMI hotkeys id=14 [slave keyboard (3)]
↳ Logitech Wireless Mouse id=15 [slave keyboard (3)]
↳ BSK30 (AVRCP) id=16 [slave keyboard (3)]
然后获取 id 鼠标 id 例如 11 (恰好是 Magic Mouse)并映射按钮。
$ xinput set-button-map 11 1 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20