Configure mouse speed (not pointer acceleration!)

KDE has not built this into its control center yet, but you can use xinput from the command line. First, run xinput list to find the device number of your mouse:

$ 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)]

On my laptop, the device id I want is 10 (SynPS/2 Synaptics TouchPad). On your system, you will have to decide which device is the correct one. Next, run xinput list-props <your device id> to see the current settings for that device:

$ 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 ]

The property you are interested in is "Device Accel Constant Deceleration (267)". To slow your mouse down, the value must be increased by running xinput set-prop <your device id> <property id> <value>:

$ xinput set-prop 10 267 5.0

In this example, the value is increased from 2.5 to 5.0 and the mouse moves at half-speed.


Just force the pointer to skip pixels, here's how:

First list input devices:

$ 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)]

In the example we see the mouse is PixArt USB Optical Mouse. Next list its properties:

$ 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

By changing "Coordinate Transformation Matrix" property we can increase the pointer speed. Documentation says it is used to calculate a pointer movement. Quoting:

By default, the CTM for every input device in X is the identity matrix. As an example, lets say you touch a touchscreen at point (400, 197) on the screen:

⎡ 1 0 0 ⎤   ⎡ 400 ⎤   ⎡ 400 ⎤
⎜ 0 1 0 ⎥ · ⎜ 197 ⎥ = ⎜ 197 ⎥
⎣ 0 0 1 ⎦   ⎣  1  ⎦   ⎣  1  ⎦

The X and Y coordinates of the device event are input in the second matrix of the calculation. The result of the calculation is where the X and Y coordinates of the event are mapped to the screen. As shown, the identity matrix maps the device coordinates to the screen coordinates without any changes.

So, we want to increase X and Y values, leaving the rest unchanged. An example from my PC:


$ xinput set-prop "PixArt USB Optical Mouse" "Coordinate Transformation Matrix" 2.4 0 0 0 2.4 0 0 0 1

Play a bit with this until you're satisfied with the speed.

These changes are active only for the current session, so once you've chosen a good sensitivity, you may apply it permanently by adding it to xorg.conf (or creating a file like /etc/X11/xorg.conf.d/40-mouse-sensitivity.conf):

Section "InputClass"
    Identifier "PixArt USB Optical Mouse"
    MatchIsPointer "Yes"
    Option "TransformationMatrix" "2.4 0 0 0 2.4 0 0 0 1"
EndSection

thanks go to Simon Thum from Xorg mailing list for giving a hint about the matrix.

UPD: note, some Windows games running in Wine may start exhibiting odd pointer behavior (e.g. it was noted that crosshair in Counter Strike 1.6 declines down until it stares the floor no matter how you move the mouse), in this case just reset X and Y of CTM back to 1 before running the game.


The terminology of the mouse settings in Linux (Xorg) are slightly different from the windows world.

There are three important settings:

  • threshold - The trigger for acceleration
  • acceleration - The speed after the threshold has been reached
  • resolution - The "speed"

These settings are independent of the Desktop Environment. They are pure X settings. So this always works. See also the mouse section of xset for a truly independent way to change these settings.

The Unity settings manager seems to rename the threshold to sensitivity. But as you are talking about KDE, that should not matter.

Only threshold and acceleration can be changed by the user. The resolution is a setting to be made in xorg.conf. But usually, the first two settings are enough for most users.

Linuxreviews has an explanation of these values.

Basically: The mouse moves at a base speed (modifiable using resolution). If the mouse moves n pixels (n = threshold) in a short time, then the base speed is multiplied with acceleration. As an example, if you want to disable acceleration completely, you can set the threshold to 0. In words: If the mouse moves 0 pixels in a short time, I'll use base-speed * acceleration. So a threshold of 0 gives you constant mouse-speed.

So, these two values give you a very fine grained control over the speed.

Tags:

Mouse

Kde4

Xorg