Table of Contents

Ubuntu - Mouse - Change Mouse Sensitivity


Determine the system

xinput list-props 8

returns:

Device 'Razer Razer DeathAdder V2':
	Device Enabled (155):	1
	Coordinate Transformation Matrix (157):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Natural Scrolling Enabled (291):	0
	libinput Natural Scrolling Enabled Default (292):	0
	libinput Scroll Methods Available (293):	0, 0, 1
	libinput Scroll Method Enabled (294):	0, 0, 0
	libinput Scroll Method Enabled Default (295):	0, 0, 0
	libinput Button Scrolling Button (296):	2
	libinput Button Scrolling Button Default (297):	2
	libinput Middle Emulation Enabled (298):	0
	libinput Middle Emulation Enabled Default (299):	0
	libinput Accel Speed (300):	0.742647
	libinput Accel Speed Default (301):	0.000000
	libinput Accel Profiles Available (302):	1, 1
	libinput Accel Profile Enabled (303):	1, 0
	libinput Accel Profile Enabled Default (304):	1, 0
	libinput Left Handed Enabled (305):	0
	libinput Left Handed Enabled Default (306):	0
	libinput Send Events Modes Available (276):	1, 0
	libinput Send Events Mode Enabled (277):	0, 0
	libinput Send Events Mode Enabled Default (278):	0, 0
	Device Node (279):	"/dev/input/event7"
	Device Product ID (280):	5426, 132
	libinput Drag Lock Buttons (307):	<no items>
	libinput Horizontal Scroll Enabled (308):	1

NOTE: The initial 8 is the Mouse Id as determined per Determine the Mouse.

  • The libinput lines indicate that this is Wayland/libinput.

On Wayland/libinput systems

xinput --set-prop "Device Name" "libinput Accel Speed" -0.9

NOTE: The number must be an integer between 1 and -1, and appears less flexible than the old Constant Deceleration setting.

  • Check this plot to see the impact of different acceleration speed values.
  • libinput calculates the mouse acceleration depending on the DPI and the parameter Acceleration Speed.

On non-Wayland/libinput systems

xinput --set-prop "Device Name" "Device Accel Constant Deceleration" 5

NOTE: The lower the number the faster it will be, similarly, higher the number slower it will be.


To turn off mouse acceleration

xinput --set-prop "Razer DeathAdder" "Device Accel Velocity Scaling" 1
xinput --set-prop "Razer DeathAdder" "Device Accel Profile" -1

Confirm any changes

xinput --list-props 8

NOTE: The 8 is the device-id per Determine the Mouse.


Using xset to change acceleration

xset can also be used to change acceleration.

NOTE: xset does not use libinput.


Get the current xset values

xset q | grep -A 1 Pointer

returns:

Pointer Control:
  acceleration:  2/1    threshold:  4

NOTE:

  • acceleration defines how many times faster the cursor will move than the default speed.
    • acceleration can be a fraction.
    • To slow down the mouse, use 1/2, 1/3, 1/4, …
    • To make it faster, use 2/1, 3/1, 4/1, …
  • threshold is the velocity required for acceleration to become effective, usually measured in device units per 10ms.
    • Threshold defines the point at which acceleration should occur in pixels per 10 ms.
    • If threshold is zero, then acceleration is treated as “the exponent of a more natural and continuous formula.”.
      • This gives precise control for slow motion but big reach for fast motion, and a progressive transition for motions in between.

Set new values

xset m acceleration threshold

NOTE:

  • acceleration defines how many times faster the cursor will move than the default speed.
    • acceleration can be a fraction.
    • To slow down the mouse, use 1/2, 1/3, 1/4, …
    • To make it faster, use 2/1, 3/1, 4/1, …
  • threshold is the velocity required for acceleration to become effective, usually measured in device units per 10ms.
    • Threshold defines the point at which acceleration should occur in pixels per 10 ms.
    • If threshold is zero, then acceleration is treated as “the exponent of a more natural and continuous formula.”.
      • This gives precise control for slow motion but big reach for fast motion, and a progressive transition for motions in between.
      • Recommended acceleration value in this case is 3/2 to 2, but not limited to that range.
        xset m 3/2 0

To reduce mouse acceleration

xset mouse 1 1

To increase the mouse speed

xset mouse 10 1

Reset xset to the default settings

xset m default

Save the New Setting Permanently

Add a new file in /usr/share/X11/xorg.conf.d/.

For example, /usr/share/X11/xorg.conf.d/60-razer-deathadder-v2.conf

/usr/share/X11/xorg.conf.d/60-razer-deathadder-v2.conf
Section "InputClass"
   Identifier      "Razer Deathadder v2"
   MatchProduct    "Razer Razer DeathAdder V2"
   Option          "ConstantDeceleration" "3"
   Option          "ButtonMapping" "1 0 3 4 5 6 7 8 9"
EndSection

NOTE:

  • The filename can be anything similar.
  • Identifier: Can be anything.
  • MatchProduct: Product name from xinput list.
  • Option: The options to change.

References

https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html#ptraccel-linear

https://wiki.archlinux.org/title/Mouse_acceleration

https://newbedev.com/decrease-mouse-sensitivity-below-the-standard-limit