Difference between revisions of "Mouse acceleration"

From ArchWiki
Jump to: navigation, search
(Disabling mouse acceleration)
(Disabling mouse acceleration: added info that restarting X is needed after changing stuff in xorg.conf)
(31 intermediate revisions by 20 users not shown)
Line 1: Line 1:
[[Category:X Server (English)]][[Category:HOWTOs (English)]][[Category:Mice (English)]]
+
[[Category:Mice]]
Mouse acceleration settings typically can be configured using tools provided by your desktop environment. Alternatively, Xorg supplies similar methods more directly, using the '''xset''' command. Along with sensitivity, your mouse speed is controlled by acceleration and threshold levels. The command synopsis is <code>xset m acceleration threshold</code>.
+
[[Category:X Server]]
 +
[[ja:Mouse acceleration]]
 +
There are several ways of setting mouse acceleration:
  
For example:
+
# By editing xorg configuration files
<pre>
+
# The {{Pkg|xorg-server-utils}} package provides two programs that can be used to change those settings from a shell or a script:
xset m 4 1
+
#* '''xset'''
</pre>
+
#* '''xinput'''
 +
# Many [[desktop environment]]s provide a configuration GUI for mouse settings. They should be easy to find and use.
  
''Acceleration'' defines how many times faster the cursor will move than the default speed, when the cursor moves more than ''threshold'' pixels in a short time. ''Acceleration'' can be a fraction, so if you want to slow down the mouse you can use 1/2, and if 3 is slightly too fast, but 2 is too slow, you can use 5/2. You effectively disable the threshold by setting it to 1, that way the cursor will always move the same speed. To get the default settings back, type <code>xset m default</code>.
+
== Setting mouse acceleration ==
  
===Disabling mouse acceleration===
+
=== In Xorg configuration ===
  
Mouse acceleration has changed dramatically in recent X server's, using 'xset' to disable acceleration doesn't work as it used to, and now is not recommend to use.
+
See {{ic|man xorg.conf}} for details.
  
Recent changes on ''''PointerAcceleration'''' can be read [http://xorg.freedesktop.org/wiki/Development/Documentation/PointerAcceleration#Introduction here]
+
Examples:
  
 +
{{hc|/etc/X11/xorg.conf.d/50-mouse-acceleration.conf|2=
 +
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
 +
}}
  
The current way of completely disabling any sort of accele/decele(ration) in xorg.conf are using two options;
+
{{hc|/etc/X11/xorg.conf.d/50-mouse-deceleration.conf|2=
 +
Section "InputClass"
 +
Identifier "My Mouse"
 +
MatchIsPointer "yes"
 +
# some curved deceleration
 +
# Option "AdaptiveDeceleration" "2"
 +
# linear deceleration (mouse speed reduction)
 +
Option "ConstantDeceleration" "2"
 +
EndSection
 +
}}
  
Option "AccelerationProfile" "-1"  
+
You can also assign settings to specific hardware by using "MatchProduct", "MatchVendor" and other matches inside class sections.
disables 'velocity-dependent pointer acceleration or deceleration' (which ignores 'xset m' commands.)
+
  
Option "AccelerationScheme" "none"
+
=== Using xset ===
disables all acceleration/deceleration (ignores 'ConstantDeceleration' option)
+
  
  Option "Sensitivity" ".5"
+
To get the current values, use:
 +
  $ xset q | grep -A 1 Pointer
  
optional setting to slow the pointer speed to desired level.
+
To set new values, type:
 +
$ xset m ''acceleration'' ''threshold''
  
 +
where ''acceleration'' defines how many times faster the cursor will move than the default speed. ''threshold'' is the velocity required for acceleration to become effective, usually measured in device units per 10ms. ''acceleration'' can be a fraction, so if you want to slow down the mouse you can use 1/2, 1/3, 1/4, ... if you want to make it faster you can use 2/1, 3/1, 4/1, ...
  
example '''xorg.conf''' with mouse options;
+
To get the default settings back:
 +
$ xset m default
  
Section "ServerLayout"
+
For more info see {{ic|man xset}}.
Identifier "l0"
+
Screen 0 "s0" 0 0
+
Option "AIGLX" "0"
+
EndSection
+
+
Section "ServerFlags"
+
Option "AutoAddDevices" "0"
+
Option "NoPM" "1"
+
EndSection
+
+
Section "InputDevice"
+
Identifier "i0"
+
Driver "mouse"
+
Option "Device" "/dev/input/mice"
+
Option "Sensitivity" ".5"
+
Option "AccelerationProfile" "-1"
+
Option "AccelerationScheme" "none"
+
Option "ExpectedRate" "1000"
+
Option "VelocityScale" "1
+
Option "AdaptiveDeceleration" "1"
+
Option "ConstantDeceleration" "1"
+
Option "Emulate3Buttons" "0"
+
EndSection
+
+
Section "Device"
+
Identifier "v0"
+
Driver "nvidia"
+
Option "ConnectedMonitor" "DFP"
+
Option "DynamicTwinView" "0"
+
EndSection
+
+
Section "Screen"
+
Identifier "s0"
+
Device "v0"
+
EndSection
+
+
Section "Extensions"
+
Option "DAMAGE" "0"
+
Option "XINERAMA" "0"
+
Option "MIT-SCREEN-SAVER" "0"
+
Option "Composite" "0"
+
EndSection
+
  
===Query currently used settings===
+
To make it permanent, edit xorg configuration (see above) or add commands to [[xprofile]]. The latter won't affect speed in a [[display manager]].
The current acceleration/threshold settings can be checked using:
+
  
xset q | grep -A 1 Pointer
+
=== Using xinput ===
  
==Making changes permanent==
+
First, get a list of devices plugged in (ignore any virtual pointers):
You can add the xset command to your ~/.xinitrc to get the desired mouse speed every time X starts.
+
$ xinput list
  
For more info see <code>man xset</code>.
+
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 {{ic|9}} is the ID of the device you wish to use. Or
 +
$ xinput list-props ''mouse brand''
 +
 
 +
where ''mouse brand'' is the name of your mouse given by {{ic|$ xinput list}}
 +
 
 +
Example, changing the property of {{ic|Constant Deceleration}} to 2:
 +
{{hc|$ xinput list-props 9|
 +
Device &#39;''mouse brand''&#39;:
 +
      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 &#39;''mouse brand''&#39; 'Device Accel Constant Deceleration' 2
 +
 
 +
To make it permanent, edit xorg configuration (see above) or add commands to [[xprofile]]. The latter won't 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's what I did to configure a generic optical mouse:
 +
First, slow down the default movement speed 3 times so that it's 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 of the results, store the preceding commands in {{ic|~/.xinitrc}}.
 +
 
 +
== Disabling mouse acceleration ==
 +
 
 +
Mouse acceleration has changed dramatically in recent X server versions; using {{Ic|xset}} to disable acceleration doesn't work as it used to and is not recommended anymore.
 +
 
 +
Recent changes on {{ic|PointerAcceleration}} can be read [http://xorg.freedesktop.org/wiki/Development/Documentation/PointerAcceleration#Introduction here].
 +
 
 +
To completely disable any sort of acceleration/deceleration, create the following file:
 +
{{hc|/etc/X11/xorg.conf.d/50-mouse-acceleration.conf|2=
 +
Section "InputClass"
 +
Identifier "My Mouse"
 +
MatchIsPointer "yes"
 +
Option "AccelerationProfile" "-1"
 +
Option "AccelerationScheme" "none"
 +
EndSection
 +
}}
 +
and restart X.

Revision as of 16:17, 7 July 2013

There are several ways of setting mouse acceleration:

  1. By editing xorg configuration files
  2. The xorg-server-utils package provides two programs that can be used to change those settings from a shell or a script:
    • xset
    • xinput
  3. Many desktop environments provide a configuration GUI for mouse settings. They should be easy to find and use.

Setting mouse acceleration

In Xorg configuration

See man xorg.conf 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.

Using xset

To get the current values, use:

$ xset q | grep -A 1 Pointer

To set new values, type:

$ xset m acceleration threshold

where acceleration defines how many times faster the cursor will move than the default speed. threshold is the velocity required for acceleration to become effective, usually measured in device units per 10ms. acceleration can be a fraction, so if you want to slow down the mouse you can use 1/2, 1/3, 1/4, ... if you want to make it faster you can use 2/1, 3/1, 4/1, ...

To get the default settings back:

$ xset m default

For more info see man xset.

To make it permanent, edit xorg configuration (see above) or add commands to xprofile. The latter won't affect speed in a display manager.

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 brand

where mouse brand 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 brand':
       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 brand' 'Device Accel Constant Deceleration' 2

To make it permanent, edit xorg configuration (see above) or add commands to xprofile. The latter won't 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's what I did to configure a generic optical mouse: First, slow down the default movement speed 3 times so that it's 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 of the results, store the preceding commands in ~/.xinitrc.

Disabling mouse acceleration

Mouse acceleration has changed dramatically in recent X server versions; using xset to disable acceleration doesn't work as it used to and is not recommended anymore.

Recent changes on PointerAcceleration can be read here.

To completely disable any sort of acceleration/deceleration, create the following file:

/etc/X11/xorg.conf.d/50-mouse-acceleration.conf
Section "InputClass"
	Identifier "My Mouse"
	MatchIsPointer "yes"
	Option "AccelerationProfile" "-1"
	Option "AccelerationScheme" "none"
EndSection

and restart X.