我想禁用由bash脚本控制的鼠标移动,因此xdotool
可以接管并撞击鼠标,否则不会成为问题。
但是,我需要这些按钮才能保持工作状态,因此仅禁用鼠标不是一种选择。
这是与这个问题相同的问题,但是那里的解决方案对我不起作用。我的鼠标似乎没有这些属性。
xinput list
显示鼠标3次。ID 10具有最多的属性,其他两个具有选项的子集。
输出xinput list-props 10
:
Device 'Logitech Gaming Mouse G502':
Device Enabled (152): 1
Coordinate Transformation Matrix (154): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Accel Speed (290): 0.000000
libinput Accel Speed Default (291): 0.000000
libinput Accel Profiles Available (292): 1, 1
libinput Accel Profile Enabled (293): 1, 0
libinput Accel Profile Enabled Default (294): 1, 0
libinput Natural Scrolling Enabled (295): 0
libinput Natural Scrolling Enabled Default (296): 0
libinput Send Events Modes Available (275): 1, 0
libinput Send Events Mode Enabled (276): 0, 0
libinput Send Events Mode Enabled Default (277): 0, 0
libinput Left Handed Enabled (297): 0
libinput Left Handed Enabled Default (298): 0
libinput Scroll Methods Available (299): 0, 0, 1
libinput Scroll Method Enabled (300): 0, 0, 0
libinput Scroll Method Enabled Default (301): 0, 0, 0
libinput Button Scrolling Button (302): 2
libinput Button Scrolling Button Default (303): 2
libinput Middle Emulation Enabled (304): 0
libinput Middle Emulation Enabled Default (305): 0
Device Node (278): "/dev/input/event2"
Device Product ID (279): 1133, 49277
libinput Drag Lock Buttons (306): <no items>
libinput Horizontal Scroll Enabled (307): 1
我尝试弄乱“坐标转换矩阵”,但据我所知,它没有任何作用。
其他属性似乎都无法帮助我-还有其他方法可以解决此问题吗?
编辑:输出xinput list
:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech Gaming Mouse G502 id=11 [slave pointer (2)]
⎜ ↳ Logitech Gaming Mouse G502 id=10 [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 G510 Gaming Keyboard id=8 [slave keyboard (3)]
↳ Logitech G510 Gaming Keyboard id=9 [slave keyboard (3)]
↳ Eee PC WMI hotkeys id=12 [slave keyboard (3)]
↳ Logitech Gaming Mouse G502 id=13 [slave keyboard (3)]
使用xinput test <ID>
我注意到只有ID 10的设备会响应任何事件。
显然,更改坐标变换矩阵确实有效,但我做错了方法。
将其设置为全0矩阵根本不执行任何操作。更改随机值可能会或不会产生影响。
最后,我注意到增大矩阵的右下角条目会减慢鼠标的速度。因此,将此值更改为较大值将具有预期的效果。
例如: xinput set-prop 10 154 1 0 0 0 1 0 0 0 1000000
这仅适用于ID为10的鼠标设备。
编辑:将其他1值设置为较小值(例如0)也会使其变慢。所以这也可行:xinput set-prop 10 154 0 0 0 0 0 0 0 0 1
更好的是,xinput test 10
与此无关。
但是,当与xdotool一起使用时,我注意到我的光标跳到了屏幕的左上角。我不确定这是否仍在此问题的范围内,但这仍然是一个问题。
编辑2:似乎是由引起跳到屏幕左上角xdotool mousemove
。如果在使用上述矩阵设置发出这样的命令后移动鼠标,则鼠标指针会跳到左上角。
为了防止这种情况发生,您可以通过相对运动来简单地跟进它。例如这样的:xdotool mousemove X Y mousemove_relative 1 1 mousemove_relative -- -1 -1
。这会将指针移动到提供的X和Y坐标,并且不受进一步的鼠标移动的影响。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句