我有 Razer DeathAdder(左手版)和 A4Tech 无线鼠标。我的问题是我不知道如何更改无线鼠标键映射(切换左键/右键单击)。有人可以指导我如何做这样的事情吗?
我的设备列表:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech Unifying Device. Wireless PID:4004 id=8 [slave pointer (2)]
⎜ ↳ Razer Razer DeathAdder id=11 [slave pointer (2)]
⎜ ↳ A4TECH USB Device id=12 [slave pointer (2)]
⎜ ↳ A4TECH USB Device 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)]
↳ Power Button id=7 [slave keyboard (3)]
↳ Logitech USB Keyboard id=9 [slave keyboard (3)]
↳ Logitech USB Keyboard id=10 [slave keyboard (3)]
这是我的 Razer xinput:
Device 'Razer Razer DeathAdder':
Device Enabled (121): 1
Coordinate Transformation Matrix (123): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (246): 0
Device Accel Constant Deceleration (247): 5.000000
Device Accel Adaptive Deceleration (248): 1.000000
Device Accel Velocity Scaling (249): 10.000000
Device Product ID (240): 5426, 22
Device Node (241): "/dev/input/event4"
Evdev Axis Inversion (250): 0, 0
Evdev Axes Swap (252): 0
Axis Labels (253): "Rel X" (131), "Rel Y" (132), "Rel Vert Wheel" (274)
Button Labels (254): "Button Left" (124), "Button Middle" (125), "Button Right" (126), "Button Wheel Up" (127), "Button Wheel Down" (128), "Button Horiz Wheel Left" (129), "Button Horiz Wheel Right" (130), "Button Side" (269), "Button Extra" (270), "Button Forward" (271), "Button Back" (272), "Button Task" (273), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243)
Evdev Middle Button Emulation (255): 0
Evdev Middle Button Timeout (256): 50
Evdev Third Button Emulation (257): 0
Evdev Third Button Emulation Timeout (258): 1000
Evdev Third Button Emulation Button (259): 3
Evdev Third Button Emulation Threshold (260): 20
Evdev Wheel Emulation (261): 0
Evdev Wheel Emulation Axes (262): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (263): 10
Evdev Wheel Emulation Timeout (264): 200
Evdev Wheel Emulation Button (265): 4
Evdev Drag Lock Buttons (266): 0
这是我的无线鼠标 xinput:
Device 'A4TECH USB Device':
Device Enabled (121): 1
Coordinate Transformation Matrix (123): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (246): 0
Device Accel Constant Deceleration (247): 1.000000
Device Accel Adaptive Deceleration (248): 1.000000
Device Accel Velocity Scaling (249): 10.000000
Device Product ID (240): 2522, 1359
Device Node (241): "/dev/input/event16"
Evdev Axis Inversion (250): 0, 0
Evdev Axes Swap (252): 0
Axis Labels (253): "Rel X" (131), "Rel Y" (132), "Rel Horiz Wheel" (245), "Rel Vert Wheel" (274)
Button Labels (254): "Button Left" (124), "Button Middle" (125), "Button Right" (126), "Button Wheel Up" (127), "Button Wheel Down" (128), "Button Horiz Wheel Left" (129), "Button Horiz Wheel Right" (130), "Button Side" (269), "Button Extra" (270), "Button Forward" (271), "Button Back" (272), "Button Task" (273), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243), "Button Unknown" (243)
Evdev Middle Button Emulation (255): 0
Evdev Middle Button Timeout (256): 50
Evdev Third Button Emulation (257): 0
Evdev Third Button Emulation Timeout (258): 1000
Evdev Third Button Emulation Button (259): 3
Evdev Third Button Emulation Threshold (260): 20
Evdev Wheel Emulation (261): 0
Evdev Wheel Emulation Axes (262): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (263): 10
Evdev Wheel Emulation Timeout (264): 200
Evdev Wheel Emulation Button (265): 4
Evdev Drag Lock Buttons (266): 0
答案1
无线鼠标的说明:我注意到它有 2 个 ID,但我认为 12 号应该是您想要使用的(如果不是,请尝试其他的)。
我看到您在第一个代码块中获得了硬件的设备 ID(只需输入 即可xinput
)。现在,记住这一点,选择您要使用的 ID,例如 12,然后使用 获取设备的详细读数xinput list-props 12
,正如您在第三个代码块中所做的那样。
现在要获取按钮排列,运行
xinput get-button-map 12
这将为您提供按钮标签列表,对于无线鼠标来说,该列表可能是 1-24。列出的信息xinput list-props 12
(在第三个代码块中)有一个“按钮标签”部分,那里的按钮标签列表(24)通常与命令给出的数字列表直接相关xinput get-button-map
。这意味着 1 将从“按钮标签”信息中引用“按钮左”,因此我们需要交换“按钮左”(1)和“按钮右”(3)。为此,请记住指定设备 ID(12),我们可以将命令缩短为 13 位数字:
xinput set-button-map 12 3 2 1 4 5 6 7 8 9 10 11 12 13
此方法适用于任何鼠标,因为我可以确认它对我的鼠标有效。
这个答案可能也很有趣,因为它与以下内容相关xinput
:
答案2
尝试 btnx:https://launchpad.net/btnx
我已经有一段时间没有用它了,但我记得它很有指导性并且易于使用。