Mouse acceleration (简体中文)

From ArchWiki
Jump to: navigation, search
翻译状态: 本文是英文页面 Mouse_acceleration翻译,最后翻译时间:2014-08-22,点击这里可以查看翻译后英文页面的改动。

这里有以下几种方式设置鼠标加速:

  1. 通过设置xorg配置文件
  2. xorg-server-utils[broken link: package not found]包提供了这两个命令让您能通过Shell和脚本方式来调整鼠标设置:
    • xset
    • xinput
  3. 大部分的desktop environment提供了图形化的鼠标设置界面,您可以非常容易的找到并使用它。

设置鼠标加速

通过xorg配置文件

参见 xorg.conf(5) 来获得详细信息.

范例:

/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

您还可以通过使用"MatchProduct", "MatchVendor" 等设置特定的硬件。

通过使用xset

查看现在的设置,请键入以下命令:

$ xset q | grep -A 1 Pointer

如要改变设置,输入:

$ xset m acceleration threshold

acceleration处输入想要加快的倍速. threshold为鼠标加速的阀值。


acceleration也可以用分数来表示,如果想要减慢鼠标的移动速度,您可以尝试1/2, 1/3, 1/4等速率, ... 如果想要更快,您也可以尝试 2/1, 3/1, 4/1等速率,比如:

$ xset m 3/2 0

as suggested in the man page, then acceleration is treated as "the exponent of a more natural and continuous formula."

如要恢复默认设置:

$ xset m default

获得更多细节,参见xset(1)页面.

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

通过使用xinput

首先,列出所有已连接电脑的输入设备(忽略Virtual pointer):

$ xinput list

记下ID号码.您也有可能需要记下设备全名当在ID容易改变的情况下。

列出鼠标的所有设置和它们的值:

$ xinput list-props 9

9是您希望使用的设备的ID值

您也可以通过使用下面的命令来达到相同的效果

$ xinput list-props mouse brand

请将mouse brand替换为在$ xinput list中得到的名字


例如,改变Constant Deceleration属性的值为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

Device Accel Constant Deceleration可以调整鼠标的移动速度。

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

设置范例

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.

取消鼠标加速

鼠标加速度的在最近的版本的x server中已经发生了很很大的变化;、,所以用xset来改变设置是不成功和不被推荐的。

here页面中您可以查看PointerAcceleration变化的内容。

想要完全取消鼠标加速、减速, 请创建以下文件:

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

并重启X。