How can I set mouse sensitivity, not just mouse acceleration?

98,622

Solution 1

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.

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.

Solution 2

The following has been copied verbatim from an answer that @Luke posted on Ask Ubuntu. I am posting it as a community wiki answer so the information can be on this site as well.


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.


Explanation of properties can be found at X.org.

If one are using this in scripts the use of full names can be of help as id etc. can change. E.g:

xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Accel Constant Deceleration" 1

Solution 3

If you're using Xorg.conf to set up your X Server, you can use that in order to set acceleration or deceleration. Just add something to the effect of:

Section "InputDevice"
    Identifier "name"
    Driver "evdev"
    Option "ConstantDeceleration" "multiplier"
EndSection

where multiplier is how many times slower you want the mouse to go. 0.5 would double the speed, or 2 would halve it. Equivalently, though more complex:

Section "InputDevice"
    Identifier "name"
    Driver "evdev"
    Option "TransformationMatrix" "a b c d e f g h i"
EndSection

where "a" through "i" are the transformation matrix, as described in other answers.
Source: xorg.conf manpage

Solution 4

I use the following settings in Mint 17.2 + Cinnamon, but I think it works in your environment as well.

xinput list # to get the id of your mouse
xinput list-props 10 # to list the properties of your mouse
xinput set-prop 10 'Device Accel Profile' -1 # turns off mouseaccel
xinput set-prop 10 'Device Accel Constant Deceleration' 1.5 # settings the sens

I suggest you to set the DPI on your mouse at maximum first (I have buttons for that). After that you can decrease the deceleration if you still have too low sens.

If everything is fine you can put this into the proper file in your system, so it will load the settings by booting. To me that file is the ~/.xinputrc.

Some info about these xinput properties: http://www.x.org/wiki/Development/Documentation/PointerAcceleration/

(Note: I love Linux! <3 After I "upgraded" my system from XP in 2009. Since then I had mouseaccel on Windows 7, no matter what accelfix I tried. Trust me, I tried all of them. Now after 6 years, I managed to turn it off on Linux Mint. :-) It was a bit too late, I ended my gaming carrier at least partially because of this. It meant -20% accuracy in my FPS. So I played at 40% instead of 50-60% acc, which is a low-med skill instead of a high. The game is dead now, but still it is a release that I don't have to bear this mouseaccel thing by using the op system.)

Share:
98,622

Related videos on Youtube

David Gay
Author by

David Gay

I love when the code feels good, you know?

Updated on September 18, 2022

Comments

  • David Gay
    David Gay over 1 year

    I can't find a single desktop environment that supports setting both mouse acceleration AND mouse sensitivity. I don't want any mouse acceleration, but I want to increase the speed of my mouse. That means that if I move the mouse the same distance, the pointer will move the same distance every time, no matter how quickly I move the mouse.

    KDE will let me set mouse acceleration to 1x, but the mouse moves too slow then, and I can't figure out how to increase the speed. I am willing to accept a CLI solution, but I have only been able to get xinput to change acceleration. I don't recall having much luck with xset, either.

    • terdon
      terdon over 10 years
      Can't you do this by increasing both the acceleration and the threshold at which the acceleration is triggered? Does this help?
    • David Gay
      David Gay over 10 years
      I don't think so. If I understand correctly, that would simply leave me with a slow mouse at 1x accel until I move the pointer a certain distance, upon which accel would kick in. I want my pointer to always move at the same velocity. I don't want any acceleration at all.
    • terdon
      terdon over 10 years
      I am not sure either, but I seem to be getting somewhere with xset m 3 400, the idea being to set the threshold high enough that you never pass it so you don't have acceleration as such. Perhaps if you play with that a bit?
    • David Gay
      David Gay over 10 years
      I know that I can eliminate acceleration, but I want to increase the SPEED without acceleration. Increased velocity, zero acceleration. I am talking in #kde right now and it seems that the only solution may be to purchase a mouse with greater DPI. :/ If I don't get a good answer in a while, I'll answer it myself as impossible.
    • Warren Young
      Warren Young over 10 years
      This was asked and answered over on the Ubuntu SE: askubuntu.com/questions/172972/…
    • Admin
      Admin almost 10 years
      I somehow landed on this page with my search for an answer and after some frustrating search engining, I managed to crank out an answer of my own which seems to work.
    • Johnny Baloney
      Johnny Baloney over 3 years
      It's 2021. In order to increase the speed of a mouse pointer I had to change to a 'faster' mouse...
  • terdon
    terdon over 10 years
    If you don't agree with what I've done here, come tell me so on this meta post.
  • David Gay
    David Gay over 10 years
    If you could just clarify: Does "Device Accel Constant Deceleration" have to do with acceleration or sensitivity? Could you please give a command example for my question? One that removes all mouse acceleration but still lets me increase mouse sensitivity (WITHOUT acceleration)?
  • terdon
    terdon over 10 years
    @oddshocks honestly, I have no idea. I copied this from the site I link to. That is also an SE site, I would just go ask them.
  • Hi-Angel
    Hi-Angel over 9 years
    @terdon so how do I increase the mouse pointer speed? The option you pointed out is set to «1.0» by default, and an attempts to decrease it farther be giving a negative value, or, at least, something like «0.1» triggers an error.
  • Hi-Angel
    Hi-Angel about 9 years
    @Wyatt8740 I recently noted that in some circumstances the property number could change on its own, for such a case it is possible to use device/property name instead of a number. I.e. with my device: xinput set-prop "PixArt USB Optical Mouse" "Coordinate Transformation Matrix" 2.400000, 0.000000, 0.000000, 0.000000, 2.400000, 0.000000, 0.000000, 0.000000, 1.000000.
  • Upe
    Upe about 9 years
    yeah, I used those strings too.
  • New Atech
    New Atech almost 9 years
    Awesome, the only thing that works for me
  • Incnis Mrsi
    Incnis Mrsi over 8 years
    Did anybody successfully run xinput set-prop 10 267 … on X.Org X Server 1.16 or newer? This doesn’t work for me because of fluctuating number of the property even on exactly the same X software: currently 272 for :0 and 273 for :1.      See also askubuntu.com/questions/581584/…
  • Hi-Angel
    Hi-Angel over 8 years
    @IncnisMrsi you can use strings directly.
  • Andrew
    Andrew about 8 years
    In my case, the device is listed twice in the pointer section of xinput list, so using the full name doesn't work. Does that make it impossible to add this to a startup script?
  • Franklin
    Franklin over 6 years
    This only works if your device allows that option, which mine didn't. You can check with xinput list-props <device-id>
  • Low power
    Low power almost 3 years
    Note this method could trigger an Xorg(1) bug that the mouse pointer may unexpectly jumps after every XWarpPointer(3) call; see unix.stackexchange.com/questions/491531/… and gitlab.freedesktop.org/xorg/xserver/-/issues/600 for details and possible workarounds.