User Tools

Site Tools


ubuntu:mouse:change_mouse_properties

This is an old revision of the document!


Ubuntu - Mouse - Change Mouse Properties

The libinput library handles most input events on a system.

  • It can process input events on both Wayland and X and can handle a variety of input devices including touchscreen displays and stylus pens.

It is recommended that libinput devices are configured through the InputClass directive.

Change Mouse Properties


Determine the Mouse

See Determine the Mouse.

  • This shows that the id of the mouse is 8 in this case.

List the Mouse Properties

xinput list-props 8

returns:

Device 'Razer Razer DeathAdder V2':
	libinput Natural Scrolling Enabled (291):	0
...

Change Properties of a Connected Device

For example, change the Natural Scrolling Enabled property.

xinput set-prop 8 291 0
xinput set-prop 8 291 1

NOTE:

  • 8: is the id of the mouse as determined by the previous step, Determine the Mouse.
  • 291: is from the List the Mouse Properties referring to the Natural Scrolling Enabled property.
  • 0: disables natural scrolling while “1” enables it.

Using an ID is not a reliable way to change a property, as these may change. A better approach is to use the full property identifier:

xinput set-prop 8 "libinput Natural Scrolling Enabled" 0
xinput set-prop 8 "libinput Natural Scrolling Enabled" 1

WARNING: Do not try to change any property having the word Default in it.

  • These are reference fallback values and any attempt to change them will result in xinput throwing an error.

Making the Changes Persistent

The method explained above changes settings for active session only.

  • When the system is rebooted, these changes will be gone.

To make them persistent, two approaches can be used.

  1. Add these commands to startup applications.
  2. Create a config file in /etc/X11/xorg.conf.d/.

Option 1

Add the commands to any startup process.

sleep 3 && xinput set-prop "Razer Razer DeathAdder V2" "libinput Natural Scrolling Enabled" 1

NOTE: The sleep 3 is a delay to wait for the session to load properly.


Option 2

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          "libinput Natural Scrolling Enabled" "true"
   Option          "ConstantDeceleration" "3"
   Option          "ButtonMapping" "1 0 3 4 5 6 7 8 9"
EndSection

NOTE:

  • The filename can be anything similar.
    • A file that has the highest number as prefix will be loaded last, overriding any options specified in previous files in case there are duplicates.
    • So by specifying 99 as a prefix, would ensure that it is loaded after other files.
  • Identifier: Can be anything.
  • MatchProduct: Product name from xinput list.
  • Option: The options to change.
    • Any number of options can be included, as shown in this example.

Changes made in the config file will take effect when the system is next rebooted.


ubuntu/mouse/change_mouse_properties.1635255937.txt.gz · Last modified: 2021/10/26 13:45 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki