Mouse pointer too fast or slow

Gnome has a really nice utility to change the speed of a mouse pointer. However, recently I bought a new mouse and I noticed that I could not control it's speed as I wished. The speed was too high, which is not very good against RSI. Thus, I set off to find an alternative way to deal with this.

The basic setting can be found under "System Settings -> Mouse And Touchpad -> Accelleration". If this does not suffice then read on.

First we need to determine about which piece of input hardware we are talking. For this we use the xinput utility:

$ xinput --list --short
⎡ Virtual core pointer                            id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ Microsft Microsoft Wireless Desktop Receiver 3.1    id=9    [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)]
    ↳ Microsft Microsoft Wireless Desktop Receiver 3.1    id=8    [slave  keyboard (3)]
    ↳ UVC Camera (046d:0994)                      id=10    [slave  keyboard (3)]

From the output we can see that I have 1 "slave pointer", which is the Microsoft mouse I need to fix. Now use this to adjust the accelleration (or in my case the decelleration). We can do this as follows:

$xinput --set-prop "pointer:Microsft Microsoft Wireless Desktop Receiver 3.1" "Device Accel Constant Deceleration" 3

or in a more general way:

$xinput --set-prop "pointer:NAME OF YOUR POINTER DEVICE" "Device Accel Constant Deceleration" SPEED_FACTOR

There is no need to become root to do this, as it is a personal setting!

The one issue with this is that it does not survive a reboot. To overcome this issue we can do create a script and autoload it together with gnome. The script:

$echo '#!/bin/sh' >> ~/.config/mouse_speed.sh
$echo xinput --set-prop "pointer:Microsft Microsoft Wireless Desktop Receiver 3.1" "Device Accel Constant Deceleration" 3 >> ~/.config/mouse_speed.sh

Then we make this script executable:

$chmod +x ~/.config/mouse_speed.sh

And we add it to the Gnome Startup Applications. To do this we type:

$gnome-session-properties

and add the script there.

That is all...

Ow, and then I want to share my source with you. I put it here as well, as this blog functions as my external memory as well.

© 2008 - 2014 Patrick Hanckmann

View Patrick Hanckmann's profile on LinkedIn