--get your your Linux knowledge
> Linux Reviews > Howtos > XFree configuration >

Setting the mouse speed in X

How to set mouse speed in X using xset or XF86Config

  1. Changing the mouse speed on the fly using xset
  2. Setting the mouse speed in XF86Config

1. Changing the mouse speed on the fly using xset

The syntax for setting the mouse acceleration and threshold using xset is

xset m acceleration threshold

The first argument, "acceleration", is a multiplier number that defines how many times faster than the standard speed the cursor will move. Try numbers between 2 and 5, setting a high multiplier like 9 makes the mouse movements very jerky and jumpy. This does not need to be a whole number, you can use 1/2 to get half the standard speed or 5/2 (=2.5) if 2 is too slow and 3 is too fast.

The second argument, threshold, defines how many pixels the mouse must move in a short period of time before the acceleration setting is used. Using a threshold of 1, as in xset m 5 1, disables this and gives you the same mouse speed at all times. Setting xset m 5 10 requires the mouse the move to move 10 pixels before the pointer is accelerated.

'xset m 5 1' is known to be a good setting.

xset m default returns the standard setting.

Add xset to ~/.xinitrc to get your desired mouse speed when X starts.

2. Setting the mouse speed in XF86Config

The mouse is configured in the file X config file XF86Config ('/etc/X11/XF86Config' or '/etc/X11/XF86Config-4').

Find the section named "InputDevice":

   Section "InputDevice"
           Identifier  "Mouse0"
   Driver      "mouse"
           Option      "Protocol" "imps/2"
           Option      "Device" "/dev/mouse"
           Option      "ZAxisMapping" "4 5"
           Option      "Resolution" "500"

The Resolution option will set the mouse device resolution to N counts per inch. Not all mice and OS support this option, and this forces this setting on all users. USB mouse generally do not support setting the mouse speed this way.

Meet new people