如何设置鼠标灵敏度,而不仅仅是鼠标加速度?

Dav*_*Gay 55 kde x11 mouse xinput

我找不到同时支持设置鼠标加速和鼠标灵敏度的单一桌面环境。我不想要任何鼠标加速,但我想提高鼠标的速度。这意味着如果我将鼠标移动相同的距离,无论我移动鼠标的速度有多快,指针每次都会移动相同的距离。

KDE 会让我把鼠标加速度设置为 1x,但是鼠标移动太慢了,我不知道如何提高速度。我愿意接受 CLI 解决方案,但我只能xinput改变加速。我也不记得对 有多少运气xset

Hi-*_*gel 51

只需强制指针跳过像素,方法如下:

首先列出输入设备:

$ xinput list
? Virtual core pointer                          id=2    [master pointer  (3)]
?   ? Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
?   ? PixArt USB Optical Mouse                  id=10   [slave  pointer  (2)]
?   ? ETPS/2 Elantech Touchpad                  id=15   [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)]
    ? Sleep Button                              id=8    [slave  keyboard (3)]
    ? USB2.0 UVC 2M WebCam                      id=9    [slave  keyboard (3)]
    ? Asus Laptop extra buttons                 id=13   [slave  keyboard (3)]
    ? AT Translated Set 2 keyboard              id=14   [slave  keyboard (3)]
    ?   USB Keyboard                            id=11   [slave  keyboard (3)]
    ?   USB Keyboard                            id=12   [slave  keyboard (3)]
Run Code Online (Sandbox Code Playgroud)

在示例中,我们看到鼠标是PixArt USB Optical Mouse。接下来列出它的属性:

$ xinput list-props "PixArt USB Optical Mouse"
Device 'PixArt USB Optical Mouse':
        Device Enabled (140):   1
        Coordinate Transformation Matrix (142): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        Device Accel Profile (265):     0
        Device Accel Constant Deceleration (266):       1.000000
        Device Accel Adaptive Deceleration (267):       1.000000
        Device Accel Velocity Scaling (268):    10.000000
        Device Product ID (260):        2362, 9488
        Device Node (261):      "/dev/input/event5"
        Evdev Axis Inversion (269):     0, 0
        Evdev Axes Swap (271):  0
        Axis Labels (272):      "Rel X" (150), "Rel Y" (151), "Rel Vert Wheel" (264)
        Button Labels (273):    "Button Left" (143), "Button Middle" (144), "Button Right" (145), "Button Wheel Up" (146), "Button Wheel Down" (147), "Button Horiz Wheel Left" (148), "Button Horiz Wheel Right" (149)
        Evdev Middle Button Emulation (274):    0
        Evdev Middle Button Timeout (275):      50
        Evdev Third Button Emulation (276):     0
        Evdev Third Button Emulation Timeout (277):     1000
        Evdev Third Button Emulation Button (278):      3
        Evdev Third Button Emulation Threshold (279):   20
        Evdev Wheel Emulation (280):    0
        Evdev Wheel Emulation Axes (281):       0, 0, 4, 5
        Evdev Wheel Emulation Inertia (282):    10
        Evdev Wheel Emulation Timeout (283):    200
        Evdev Wheel Emulation Button (284):     4
        Evdev Drag Lock Buttons (285):  0
Run Code Online (Sandbox Code Playgroud)

通过更改“坐标变换矩阵”属性,我们可以提高指针速度。文档说它用于计算指针移动。引用:

默认情况下,X 中每个输入设备的 CTM 都是单位矩阵。例如,假设您在屏幕上的 (400, 197) 点触摸触摸屏:

? 1 0 0 ?   ? 400 ?   ? 400 ?
? 0 1 0 ? · ? 197 ? = ? 197 ?
? 0 0 1 ?   ?  1  ?   ?  1  ?
Run Code Online (Sandbox Code Playgroud)

设备事件的 X 和 Y 坐标输入到计算的第二个矩阵中。计算的结果是事件的 X 和 Y 坐标映射到屏幕的位置。如图所示,单位矩阵将设备坐标映射到屏幕坐标,没有任何变化。

因此,我们要增加XY值,其余保持不变。我电脑上的一个例子:


$ xinput set-prop "PixArt USB Optical Mouse" "Coordinate Transformation Matrix" 2.4 0 0 0 2.4 0 0 0 1
Run Code Online (Sandbox Code Playgroud)

稍微玩一下,直到您对速度感到满意为止。

感谢来自 Xorg 邮件列表的 Simon Thum 提供有关矩阵的提示。

UPD:请注意,在 Wine 中运行的一些 Windows 游戏可能会开始表现出奇怪的指针行为(例如,有人注意到无论您如何移动鼠标反恐精英 1.6 中的十字准线都会下降直到盯着地板),在这种情况下只需重置X和在运行游戏之前,CTM 的Y回到1

  • @Wyatt8740 我最近注意到,在某些情况下,属性编号可能会自行更改,在这种情况下,可以使用设备/属性名称而不是编号。即我的设备:`xinput set-prop "PixArt USB Optical Mouse" "Coordinate Transformation Matrix" 2.400000, 0.000000, 0.000000, 0.000000, 2.400000, 0.000000, 0.0000.0000.0000.0000 (2认同)

ter*_*don 21

以下内容是从@Luke在 Ask Ubuntu 上发布的答案中逐字复制的。我将其作为社区 wiki 答案发布,因此该信息也可以在此站点上。


KDE 尚未将其内置到其控制中心,但您可以从命令行使用 xinput。首先,运行xinput list以查找鼠标的设备号:

$ xinput list
? Virtual core pointer                          id=2    [master pointer  (3)]
?   ? Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
?   ? SynPS/2 Synaptics TouchPad                id=10   [slave  pointer  (2)]
? Virtual core keyboard                         id=3    [master keyboard (2)]
    ? Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ? AT Translated Set 2 keyboard              id=9    [slave  keyboard (3)]
Run Code Online (Sandbox Code Playgroud)

在我的笔记本电脑上,我想要的设备 ID 是 10(SynPS/2 Synaptics TouchPad)。在您的系统上,您必须决定哪个设备是正确的。接下来,运行xinput list-props <your device id>以查看该设备的当前设置:

$ xinput list-props 10
Device 'SynPS/2 Synaptics TouchPad':
    Device Enabled (144):   1
    Device Accel Profile (266):     1
    Device Accel Constant Deceleration (267):       2.500000
    Device Accel Adaptive Deceleration (268):       1.000000
    Device Accel Velocity Scaling (269):    12.500000
  [ many more settings omitted ]
Run Code Online (Sandbox Code Playgroud)

您感兴趣的属性是“Device Accel Constant Deceleration (267)”。要减慢鼠标速度,必须通过运行来增加该值xinput set-prop <your device id> <property id> <value>

$ xinput set-prop 10 267 5.0
Run Code Online (Sandbox Code Playgroud)

在本例中,该值从 2.5 增加到 5.0,鼠标以半速移动。


可以在X.org找到对属性的解释。

如果在脚本中使用它,则使用全名可能会有所帮助,因为 id 等可以更改。例如:

xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Accel Constant Deceleration" 1
Run Code Online (Sandbox Code Playgroud)

  • 如果您能澄清一下:“设备加速度恒定减速度”是否与加速度或灵敏度有关?您能否为我的问题提供一个命令示例?一种消除所有鼠标加速但仍让我增加鼠标灵敏度(无加速)的? (2认同)
  • 仅当您的设备允许该选项时,这才有效,而我的设备不允许。您可以使用“xinput list-props &lt;device-id&gt;”进行检查 (2认同)

小智 6

如果您使用 Xorg.conf 来设置您的 X 服务器,您可以使用它来设置加速或减速。只需添加一些效果:

Section "InputDevice"
    Identifier "name"
    Driver "evdev"
    Option "ConstantDeceleration" "multiplier"
EndSection
Run Code Online (Sandbox Code Playgroud)

其中 multiplier 是您希望鼠标移动的速度慢多少倍。0.5 会使速度加倍,或者 2 会使速度减半。同样,虽然更复杂:

Section "InputDevice"
    Identifier "name"
    Driver "evdev"
    Option "TransformationMatrix" "a b c d e f g h i"
EndSection
Run Code Online (Sandbox Code Playgroud)

其中“a”到“i”是转换矩阵,如其他答案中所述。
来源:xorg.conf 联机帮助页