How to change mouse sensitivity without mouse acceleration?

I know there is a way to change it by modifying the “Coordinate Transformation Matrix”, whatever that is, but I want a simpler method, like how you would do it in a DE, maybe with a slider, changing a variable, or something that’s simple or easy to do without drawbacks. Any ideas?

If you want easy then you may look for lxinput. I am not sure if it works since I do not use it. But the same way as lxappearance it does not drag the whole DE bloat with it.

It’s a witchcraft. :mage: That’s what it is.
See this wiki page for explanation.

It modifies x,y,z movement vector of your mouse and translates it to x11 server.

Basicaly you need to know your device properties.
xinput --list to find id of your mouse.

~ >>> xinput --list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ INPUT DEVICE Mouse    	id=10	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
...

So for me it is device id=10.
Then find Coordinate Transformation Matrix.

~ >>> xinput --list-props 10
Device 'MOSART Semi. 2.4G INPUT DEVICE Mouse':
	Device Enabled (154):	1
	Coordinate Transformation Matrix (156):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
...

Note number in the brackets 156.

The numbers after are just the values of the matrix written in a single line.

1 0 0
0 1 0
0 0 1

In my case it is just an identity matrix → if this matrix multiply with a (x,y,z) vector I will get the same (x,y,z) vector.

If I change the matrix to

2 0 0
0 1 0
0 0 1

Then after multiplication I will get double x but the same y → (2x, y, z) vector. The mouse will move twice as fast horizontaly than before but it will be moving verticaly with the same speed.

It gets funny when you want to implement some screen rotation. I will not go there. :grin:

You can set the new matrix like:

xinput --set-prop 10 156 2 0 0 0 1 0 0 0 1

Can be scripted

#!/bin/bash
speed=$1
id=10
CTM=156
xinput --set-prop $id $CTM $speed 0 0 0 $speed 0 0 0 1

And call it with the speed parameter - e.g. ./mouse_speed 1.2. You will have to make some more effort to find out id or use name of the mouse. CTM can be replaced with literal text 'Coordinate Transformation Matrix'.

Take your pick - i3wm is not DE so it is missing some tools.
Or get a mouse with variable DPI like I did. :grin:

edit: fixed typo

2 Likes

I can wholeheartedly recommend this video course on Linear Algebra by 3blue1brown:

It’s probably the easiest way to get a deep understanding of matrices and vectors. And it’s free.

Should not that be CTM=156? Either that, or $CTM should be replaced by $CTP.

1 Like

You are correct.
Of course, I was just testing you if you notice it. :sweat_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.