Mouse acceleration: Difference between revisions
No edit summary |
m (→Disabling mouse acceleration: The xorg config option does not correlate to the runtime property, switch to the correct config option) |
||
(77 intermediate revisions by 37 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Mice]] | [[Category:Mice]] | ||
[[Category:X | [[Category:X server]] | ||
[[ja: | [[ja:マウスのアクセラレーション]] | ||
[[zh- | [[zh-hans:Mouse acceleration]] | ||
{{Related articles start}} | |||
{{Related|Mouse buttons}} | |||
{{Related|Mouse polling rate}} | |||
{{Related articles end}} | |||
== Disabling mouse acceleration == | |||
Using Xorg, Archlinux sets libinput as the default driver in | |||
"/usr/share/X11/xorg.conf.d/40-libinput.conf" | |||
To activate the "flat" profile for our pointer device, we need to set the "flat" profile to 1 and the "adaptive" and "custom" profile options to 0. | |||
Find out your device id. | |||
# xinput | |||
The first number indicates the default acceleration profile, the second number indicates the flat profile (No Acceleration), and the third number indicates a custom profile. To activate the flat profile: | |||
# xinput set-prop "deviceid" "libinput Accel Profile Enabled" 0 1 0 | |||
Confirm the changes: | |||
# xinput list-props "deviceid" | |||
Make it persistent by adding the option to the pointer section in "/usr/share/X11/xorg.conf.d/40-libinput.conf". | |||
Section "InputClass" | |||
Identifier "libinput pointer catchall" | |||
MatchIsPointer "on" | |||
MatchDevicePath "/dev/input/event*" | |||
Driver "libinput" | |||
Option "AccelProfile" "flat" | |||
EndSection | |||
== Configuring mouse acceleration == | |||
{{Accuracy|Configuration depends on the input driver, libinput can be used in [[Xorg]]. Each subsection should explicitly state which driver is assumed.}} | |||
Setting the mouse acceleration depends on the windowing protocol you are using: either [[Xorg]] or [[Wayland]]. | |||
* On [[Xorg]], there are several ways of setting mouse acceleration | |||
:* by editing Xorg configuration files | |||
:* {{Pkg|xorg-xset}} and {{Pkg|xorg-xinput}} which provide ''xset'' and ''xinput'' respectively | |||
:* and configuration interfaces common in [[desktop environments]]. | |||
* If you are using [[Wayland]], the events are controlled via [[libinput]]. It is the compositor's job to expose the settings brought by libinput. There is currently no standard way to change settings across compositors.[https://www.reddit.com/r/gnome/comments/3upay2/wayland_where_are_the_mouse_acceleration_options/] | |||
* [[GNOME]] manages mouse acceleration by itself. A choice between "adaptive" and "flat" profiles can be chosen by installing {{Pkg|dconf-editor}} and editing the value in org/gnome/desktop/peripherals/mouse/acceleration-profile. Alternatively, {{Pkg|gnome-tweaks}} can also be used to edit the org/gnome/desktop/peripherals/mouse/acceleration-profile. | |||
== Mouse acceleration with libinput == | |||
When using the adaptive pointer acceleration profile, [[libinput]] calculates the mouse acceleration depending on the DPI and the parameter {{ic|Acceleration Speed}} [https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html]. libinput relies on the resolution reported by [[evdev]] [https://wayland.freedesktop.org/libinput/doc/latest/normalization-of-relative-motion.html]. Feedback settings set with {{ic|xset m}} are effectively ignored. When using the flat pointer acceleration profile, the acceleration factor is constant regardless of the velocity of the pointer. This provides 1:1 movement between the device and the pointer on-screen. | |||
=== Changing the acceleration === | |||
Find the id of your device with {{ic|xinput list}} and set the acceleration speed with the following command. Note that the acceleration speed has to be in the range of [-1,1]. Check [https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html#ptraccel-linear this plot] to see the impact of different acceleration speed values. | |||
$ xinput --set-prop <device id> 'libinput Accel Speed' <acceleration factor> | |||
Confirm your changes with the following: | |||
$ xinput --list-props <device id> | |||
=== Persistent configuration === | |||
libinput does not store configuration options, it is up to the caller to manage these. Under Wayland configuration is restored by the desktop environment. Under X {{Pkg|xf86-input-libinput}} reads the xorg configuration files and applies the options [https://wayland.freedesktop.org/libinput/doc/latest/faqs.html#how-do-i-configure-my-device-on-x]. To make changes persistent under X create a file like this: | |||
{{hc|/etc/X11/xorg.conf.d/99-libinput-custom-config.conf| | |||
Section "InputClass" | |||
Identifier "<something to identify this snippet>" | |||
MatchDriver "libinput" | |||
MatchProduct "<substring of the device name>" | |||
Option "AccelSpeed" "<e.g. 0.3>" | |||
EndSection | |||
}} | |||
For further options see {{man|4|libinput}}. | |||
== Setting mouse acceleration == | == Setting mouse acceleration == | ||
Line 15: | Line 73: | ||
=== In Xorg configuration === | === In Xorg configuration === | ||
See {{ | {{Style|Do not use comments in code blocks, provide more description in the wiki text instead.}} | ||
See {{man|5|xorg.conf}} for details. | |||
Examples: | Examples: | ||
Line 41: | Line 101: | ||
}} | }} | ||
You can also assign settings to specific hardware by using "MatchProduct", "MatchVendor" and other matches inside class sections. | You can also assign settings to specific hardware by using "MatchProduct", "MatchVendor" and other matches inside class sections. Run {{ic|lsusb}} to find out the product name and vendor to match: | ||
$ lsusb -v | grep -e idProduct -e idVendor | |||
$ | |||
If you are unable to identify your device, try running {{ic|xinput list}}. Some devices the use Logitech Unifying Recceiver share the same USB connection therefore, the mouse do not appear using {{ic|lsusb}} | |||
=== Using xinput === | === Using xinput === | ||
First, get a list of devices plugged in (ignore any virtual pointers): | First, get a list of devices plugged in (ignore any virtual pointers): | ||
$ xinput list | $ xinput list | ||
Line 74: | Line 116: | ||
Get a list of available properties and their current values available for modification with | Get a list of available properties and their current values available for modification with | ||
$ xinput list-props 9 | $ xinput list-props 9 | ||
where {{ic|9}} is the ID of the device you wish to use. Or | where {{ic|9}} is the ID of the device you wish to use. Or | ||
where ''mouse | $ xinput list-props "''mouse name''" | ||
where {{ic|''mouse name''}} is the name of your mouse given by {{ic|xinput list}}. | |||
Example, changing the property of {{ic|Constant Deceleration}} to 2: | Example, changing the property of {{ic|Constant Deceleration}} to 2: | ||
{{hc|$ xinput list-props 9| | {{hc|$ xinput list-props 9| | ||
Device '''mouse | Device '''mouse name''': | ||
Device Enabled (121): 1 | Device Enabled (121): 1 | ||
Device Accel Profile (240): 0 | Device Accel Profile (240): 0 | ||
Line 90: | Line 135: | ||
Device Accel Velocity Scaling (244): 10.000000 | Device Accel Velocity Scaling (244): 10.000000 | ||
}} | }} | ||
$ xinput --set-prop | $ xinput --set-prop "''mouse name''" "Device Accel Constant Deceleration" 2 | ||
To make it permanent, edit | To make it permanent, edit Xorg configuration (see above) or add commands to [[xprofile]]. The latter will not affect speed in a [[display manager]]. | ||
=== Configuration example === | === Configuration example === | ||
You may need to resort to using more than one method to achieve your desired mouse settings. Here | You may need to resort to using more than one method to achieve your desired mouse settings. Here is what I did to configure a generic optical mouse: | ||
First, slow down the default movement speed 3 times so that it | First, slow down the default movement speed 3 times so that it is more precise. | ||
$ xinput --set-prop 9 'Device Accel Constant Deceleration' 3 & | $ xinput --set-prop 9 'Device Accel Constant Deceleration' 3 & | ||
Then, enable acceleration and make it 3 times faster after moving past 6 units. | Then, enable acceleration and make it 3 times faster after moving past 6 units. | ||
$ xset mouse 3 6 & | $ xset mouse 3 6 & | ||
If you are satisfied with the results, store the preceding commands in {{ic|~/.xinitrc}}. | |||
{{ | |||
}} | |||
Latest revision as of 01:16, 12 April 2024
Disabling mouse acceleration
Using Xorg, Archlinux sets libinput as the default driver in
"/usr/share/X11/xorg.conf.d/40-libinput.conf"
To activate the "flat" profile for our pointer device, we need to set the "flat" profile to 1 and the "adaptive" and "custom" profile options to 0.
Find out your device id.
# xinput
The first number indicates the default acceleration profile, the second number indicates the flat profile (No Acceleration), and the third number indicates a custom profile. To activate the flat profile:
# xinput set-prop "deviceid" "libinput Accel Profile Enabled" 0 1 0
Confirm the changes:
# xinput list-props "deviceid"
Make it persistent by adding the option to the pointer section in "/usr/share/X11/xorg.conf.d/40-libinput.conf".
Section "InputClass" Identifier "libinput pointer catchall" MatchIsPointer "on" MatchDevicePath "/dev/input/event*" Driver "libinput" Option "AccelProfile" "flat" EndSection
Configuring mouse acceleration
Setting the mouse acceleration depends on the windowing protocol you are using: either Xorg or Wayland.
- On Xorg, there are several ways of setting mouse acceleration
- by editing Xorg configuration files
- xorg-xset and xorg-xinput which provide xset and xinput respectively
- and configuration interfaces common in desktop environments.
- If you are using Wayland, the events are controlled via libinput. It is the compositor's job to expose the settings brought by libinput. There is currently no standard way to change settings across compositors.[1]
- GNOME manages mouse acceleration by itself. A choice between "adaptive" and "flat" profiles can be chosen by installing dconf-editor and editing the value in org/gnome/desktop/peripherals/mouse/acceleration-profile. Alternatively, gnome-tweaks can also be used to edit the org/gnome/desktop/peripherals/mouse/acceleration-profile.
Mouse acceleration with libinput
When using the adaptive pointer acceleration profile, libinput calculates the mouse acceleration depending on the DPI and the parameter Acceleration Speed
[2]. libinput relies on the resolution reported by evdev [3]. Feedback settings set with xset m
are effectively ignored. When using the flat pointer acceleration profile, the acceleration factor is constant regardless of the velocity of the pointer. This provides 1:1 movement between the device and the pointer on-screen.
Changing the acceleration
Find the id of your device with xinput list
and set the acceleration speed with the following command. Note that the acceleration speed has to be in the range of [-1,1]. Check this plot to see the impact of different acceleration speed values.
$ xinput --set-prop <device id> 'libinput Accel Speed' <acceleration factor>
Confirm your changes with the following:
$ xinput --list-props <device id>
Persistent configuration
libinput does not store configuration options, it is up to the caller to manage these. Under Wayland configuration is restored by the desktop environment. Under X xf86-input-libinput reads the xorg configuration files and applies the options [4]. To make changes persistent under X create a file like this:
/etc/X11/xorg.conf.d/99-libinput-custom-config.conf
Section "InputClass" Identifier "<something to identify this snippet>" MatchDriver "libinput" MatchProduct "<substring of the device name>" Option "AccelSpeed" "<e.g. 0.3>" EndSection
For further options see libinput(4).
Setting mouse acceleration
In Xorg configuration
See xorg.conf(5) for details.
Examples:
/etc/X11/xorg.conf.d/50-mouse-acceleration.conf
Section "InputClass" Identifier "My Mouse" MatchIsPointer "yes" # set the following to 1 1 0 respectively to disable acceleration. Option "AccelerationNumerator" "2" Option "AccelerationDenominator" "1" Option "AccelerationThreshold" "4" EndSection
/etc/X11/xorg.conf.d/50-mouse-deceleration.conf
Section "InputClass" Identifier "My Mouse" MatchIsPointer "yes" # some curved deceleration # Option "AdaptiveDeceleration" "2" # linear deceleration (mouse speed reduction) Option "ConstantDeceleration" "2" EndSection
You can also assign settings to specific hardware by using "MatchProduct", "MatchVendor" and other matches inside class sections. Run lsusb
to find out the product name and vendor to match:
$ lsusb -v | grep -e idProduct -e idVendor
If you are unable to identify your device, try running xinput list
. Some devices the use Logitech Unifying Recceiver share the same USB connection therefore, the mouse do not appear using lsusb
Using xinput
First, get a list of devices plugged in (ignore any virtual pointers):
$ xinput list
Take note of the ID. You may also use the full name in commands if the ID is prone to changing.
Get a list of available properties and their current values available for modification with
$ xinput list-props 9
where 9
is the ID of the device you wish to use. Or
$ xinput list-props "mouse name"
where mouse name
is the name of your mouse given by xinput list
.
Example, changing the property of Constant Deceleration
to 2:
$ xinput list-props 9
Device 'mouse name': Device Enabled (121): 1 Device Accel Profile (240): 0 Device Accel Constant Deceleration (241): 1.000000 Device Accel Adaptive Deceleration (243): 1.000000 Device Accel Velocity Scaling (244): 10.000000
$ xinput --set-prop "mouse name" "Device Accel Constant Deceleration" 2
To make it permanent, edit Xorg configuration (see above) or add commands to xprofile. The latter will not affect speed in a display manager.
Configuration example
You may need to resort to using more than one method to achieve your desired mouse settings. Here is what I did to configure a generic optical mouse: First, slow down the default movement speed 3 times so that it is more precise.
$ xinput --set-prop 9 'Device Accel Constant Deceleration' 3 &
Then, enable acceleration and make it 3 times faster after moving past 6 units.
$ xset mouse 3 6 &
If you are satisfied with the results, store the preceding commands in ~/.xinitrc
.