User Tools

Site Tools


ubuntu:mouse:change_mouse_properties

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.


Options that can used in the X11 config file

The following options can be used in the config file in /etc/X11/xorg.conf.d/

OptionDescription
Option “AccelProfile” “string”Sets the pointer acceleration profile to the given profile. Permitted values are adaptive, flat. Not all devices support this option or all profiles. If a profile is unsupported, the default profile for this device is used. For a description on the profiles and their behavior, see the libinput documentation.
Option “AccelSpeed” “float”Sets the pointer acceleration speed within the range [-1, 1].
Option “ButtonMapping” “string”Sets the logical button mapping for this device, see Map Mouse Buttons. The string must be a space-separated list of button mappings in the order of the logical buttons on the device, starting with button 1. The default mapping is “1 2 3 … 32”. A mapping of 0 deactivates the button. Multiple buttons can have the same mapping. Invalid mapping strings are discarded and the default mapping is used for all buttons. Buttons not specified in the users mapping use the default mapping.
Option “CalibrationMatrix” “string”A string of 9 space-separated floating point numbers, in the order “a b c d e f g h i”. Sets the calibration matrix to the 3×3 matrix where the first row is (abc), the second row is (def) and the third row is (ghi).
Option “ClickMethod” “string”Enables a click method. Permitted values are none, buttonareas, clickfinger. Not all devices support all methods, if an option is unsupported, the default click method for this device is used.
Option “DisableWhileTyping” “bool”Indicates if the touchpad should be disabled while typing on the keyboard (this does not apply to modifier keys such as Ctrl or Alt).
Option “Device” “string”Specifies the device through which the device can be accessed. This will generally be of the form “/dev/input/eventX”, where X is some integer. When using InputClass directives, this option is set by the server. The mapping from device node to hardware is system-dependent. Property: “Device Node” (read-only).
Option “DragLockButtons” “L1 B1 L2 B2 …“Sets “drag lock buttons” that simulate a button logically down even when it has been physically released. To logically release a locked button, a second click of the same button is required.
If the option is a single button number, that button acts as the “meta” locking button for the next button number. See section below Button Drag Lock for details.
If the option is a list of button number pairs, the first number of each number pair is the lock button, the second number the logical button number to be locked. See section below Button Drag Lock for details.
For both meta and button pair configuration, the button numbers are device button numbers, i.e. the ButtonMapping applies after drag lock.
Option “HorizontalScrolling” “bool”Disables horizontal scrolling. When disabled, this driver will discard any horizontal scroll events from libinput. Note that this does not disable horizontal scrolling, it merely discards the horizontal axis from any scroll events.
Option “LeftHanded” “bool”Enables left-handed button orientation, i.e. swapping left and right buttons.
Option “MiddleEmulation” “bool”Enables middle button emulation. When enabled, pressing the left and right buttons simultaneously produces a middle mouse button click.
Option “NaturalScrolling” “bool”Enables or disables natural scrolling behavior.
Option “RotationAngle” “float”Sets the rotation angle of the device to the given angle, in degrees clockwise. The angle must be between 0.0 (inclusive) and 360.0 (exclusive).
Option “ScrollButton” “int”Designates a button as scroll button. If the ScrollMethod is button and the button is logically down, x/y axis movement is converted into scroll events.
Option “ScrollButtonLock” “bool”Enables or disables the scroll button lock. If enabled, the ScrollButton is considered logically down after the first click and remains down until the second click of that button. If disabled (the default), the ScrollButton button is considered logically down while held down and up once physically released.
Option “ScrollMethod” “string”Enables a scroll method. Permitted values are none, twofinger, edge, button. Not all devices support all options, if an option is unsupported, the default scroll option for this device is used.
Option “ScrollPixelDistance” “int”Sets the movement distance, in “pixels”, required to trigger one logical wheel click. This option only applies to the scroll methods twofinger, edge, button. See section Scroll Pixel Distance for more details.
Option “SendEventsMode” "(disabled|enabled|disabled-on-external-mouse)"Sets the send events mode to disabled, enabled, or “disable when an external mouse is connected”.
Option “TabletToolPressureCurve” “x0/y0 x1/y1 x2/y2 x3/y3”Set the pressure curve for a tablet stylus to the bezier formed by the four points. The respective x/y coordinate must be in the [0.0, 1.0] range. For more information see section below Tablet Stylus Pressure Curve.
Option “TabletToolAreaRatio” “w:h”Sets the area ratio for a tablet tool. The area always starts at the origin (0/0) and expands to the largest available area with the specified aspect ratio. Events outside this area are cropped to the area. The special value “default” is used for the default mapping (i.e. the device-native mapping). For more information see section below Tablet Tool Area Ratio.
Option “Tapping” “bool”Enables or disables tap-to-click behavior.
Option “TappingButtonMap” "(lrm|lmr)"Set the button mapping for 1/2/3-finger taps to left/right/middle or left/middle/right, respectively.
Option “TappingDrag” “bool”Enables or disables drag during tapping behavior (“tap-and-drag”). When enabled, a tap followed by a finger held down causes a single button down only, all motions of that finger thus translate into dragging motion. Tap-and-drag requires option Tapping to be enabled.
Option “TappingDragLock” “bool”Enables or disables drag lock during tapping behavior. When enabled, a finger up during tap-and-drag will not immediately release the button. If the finger is set down again within the timeout, the dragging process continues.

NOTE: For all options, the options are only parsed if the device supports that configuration option.

  • For all options, the default value is the one used by libinput.
  • On configuration failure, the default value is applied.

Button Drag Lock

Button drag lock holds a button logically down even when the button itself has been physically released since.

Button drag lock comes in two modes:

  1. meta mode: A meta button click activates drag lock for the next button press of any other button.
    • A button click in the future will keep that button held logically down until a subsequent click of that same button.
    • The meta button events themselves are discarded.
    • A separate meta button click is required each time a drag lock should be activated for a button in the future.
  2. pairs mode: Each button can be assigned a target locking button.
    • On button click, the target lock button is held logically down until the next click of the same button.
    • The button events themselves are discarded and only the target button events are sent.

NOTE: This feature is provided by this driver, not by libinput.


Tablet Tool Pressurecurve

The pressure curve affects how stylus pressure is reported.

  • By default, the hardware pressure is reported as-is.
  • By setting a pressure curve, the feel of the stylus can be adjusted to be more like e.g. a pencil or a brush.

The pressure curve is a cubic Bezier curve, drawn within a normalized range of 0.0 to 1.0 between the four points provided.

  • This normalized range is applied to the tablets pressure input so that the highest pressure maps to 1.0.
  • The points must have increasing x coordinates, if x0 is larger than 0.0 all pressure values lower than x0 are equivalent to y0.
  • If x3 is less than 1.0, all pressure values higher than x3 are equivalent to y3.

The input for a linear curve (default) is “0.0/0.0 0.0/0.0 1.0/1.0 1.0/1.0”;

  • a slightly depressed curve (firmer) might be “0.0/0.0 0.05/0.0 1.0/0.95 1.0/1.0”;
  • a slightly raised curve (softer) might be “0.0/0.0 0.0/0.05 0.95/1.0 1.0/1.0”.

NOTE: This feature is provided by this driver, not by libinput.


Tablet Tool Area Ratio

By default, a tablet tool can access the whole sensor area and the tablet area is mapped to the available screen area.

  • For external tablets, the height:width ratio of the tablet may be different to that of the monitor, causing the skew of input data.

To avoid this skew of input data, an area ratio may be set to match the ratio of the screen device.

  • For example, a ratio of 4:3 will reduce the available area of the tablet to the largest available area with a ratio of 4:3.
  • Events within this area will scale to the tablets announced axis range, the area ratio is thus transparent to the X server.
  • Any events outside this area will send events equal to the maximum value of that axis.
  • The area always starts at the devices origin in its current rotation, i.e. it takes left-handed-ness into account.

NOTE: This feature is provided by this driver, not by libinput.


References

ubuntu/mouse/change_mouse_properties.txt · Last modified: 2021/10/26 15:33 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki