Adjusting mouse sensitivity on Linux, and why you might want to

December 26, 2015

Suppose, not entirely hypothetically, that you are moving from an old and relatively low resolution mouse to a new high resolution mouse, say a 1200 DPI mouse. If you do nothing, what you'll experience is that your new mouse is very twitchy and it's hard to point precisely to small things even when you're trying to move the mouse pointer slowly and carefully. This can easily wind up giving you unhappy feelings about your new mouse and of course it's generally frustrating. So what you want to do is turn down the mouse sensitivity so that it feels more like your old mouse.

(Some of this will depend on how your new mouse feels and moves relative to your old mouse. If you had to make sweeping moves with your old mouse and your new mouse is one that you can do tiny shifts with, you may not need to turn down the sensitivity very much at all. And the worst case is moving the other way, from a low resolution mouse that you just nudged around lightly to a high resolution mouse that wants you to move it around with sweeping gestures.)

As usual, the ArchLinux wiki has a pretty good page on mouse acceleration that steered me straight to the xinput command's ability to set detailed properties, even on a per-mouse basis (this is potentially important if you have more than one mouse that you might plug in). For me the most important property to set was 'Device Accel Constant Deceleration':

xinput --set-prop '<MOUSE NAME>' 'Device Accel Constant Deceleration' 2.2

The other setting I change is the 'Device Accel Velocity Scaling', because the default value of '10' is apparently based on a mouse sample rate of 100 Hz instead of my actual one of 125 Hz (see here for details on this). So I set:

xinput --set-prop '<MOUSE NAME>' 'Device Accel Velocity Scaling' 8

Note that total effect I get depends on both of these settings together, which means that there's no point in tuning everything carefully for one setting and then adjusting the other. Adjust them both first and tune from there.

(I never tried to 'tune' the velocity scaling, since it theoretically has a well defined proper value.)

I determined the deceleration figure by starting with 1200 DPI divided by the resolution of another mouse that I use and am happy with the feel of, but then I adjusted things to taste several times. The most important thing is that the mouse feel right to you; the math is just a starting point. This also means that you may not want to bother changing the velocity scaling; I did it because I'm the kind of person who usually sets that kind of stuff.

(Of course, one fly in the ointment of working out a careful DPI scaling if you also set the velocity scaling is that your old mouse will have been running not just at its lower DPI but also at the default velocity scaling. I have no idea what exact effect this has, but I expect that it has some.)

If or when I move to a high-DPI display, I expect that I'll want to reduce or reverse this mouse resolution reduction, since smaller pixels make the same mouse movement (in pixels) cover less physical area on screen. Of course by the time I get a high-DPI display, X or something else in the environment may be helpfully compensating for this effect (in much the same way that browsers on high-DPI displays redefine what a CSS 'pixel' means).

Also, I started out with higher values for deceleration and have been slowly adjusting it downwards (ie, less deceleration) over time. You may find that you have a similar adjustment process to a high-DPI mouse.

(Another reference to doing this is here, and also this StackExchange question and answers.)

PS: long distance movement of a high-DPI mouse also interacts with X's basic xset-based mouse acceleration. I found that I was okay with the normal default settings here once I'd set the deceleration in xinput, but you may have to play around with that.

Written on 26 December 2015.
« I like Magit, the GNU Emacs package for Git
A confession: I find rejecting spam at SMTP time to be more satisfying »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sat Dec 26 01:41:19 2015
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.