如何在Ubuntu 16.04中禁用鼠标加速
我检查了当前可用的答案,但它们似乎都没有永久禁用鼠标加速。
xset m 0 0
似乎暂时禁用它,但它会在几分钟内恢复。
如何永久禁用鼠标加速?
您可以永久修改鼠标驱动程序的某些参数,即重新启动。
首先列出Xorg输入设备。
结果是我现在的机器,并且在不同情况下会有所不同。
列出终端中的Xorg会话输入设备(CRTL-ALT + T):
$ xinput --list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad id=10 [slave pointer (2)] ⎜ ↳ PS/2 Generic Mouse id=11 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Sleep Button id=8 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=9 [slave keyboard (3)] ↳ HP WMI hotkeys id=12 [slave keyboard (3)]
因此,我的鼠标由以下标识:“PS / 2 Generic Mouse”并具有标识符11.对于您而言,它可能会有所不同。
接下来,要列出鼠标属性,请在终端中执行:
$ xset q | grep -A 1 Pointer Pointer Control: acceleration: 2/1 threshold: 4
要试验零鼠标加速度参数,请使用:
$ xset m 0/1 4
您的设备可能包含其他参数值。 您可以尝试使用它们,直到您对结果满意为止。 使用cli实用程序xset
允许您即时调整设备参数,即无需重新启动Xorg会话。 但是,重新启动后不会保留这些设置 。
您需要在/usr/share/X11/xorg.conf.d/
创建一个新文件,使它们持久化(直到下一次驱动程序或系统升级)。 例如 :
$ cd /usr/share/X11/xorg.conf.d $ sudo vim 80-mouse-accel-disable.conf Section "InputClass" Identifier "Set mouse acceleration to zero" MatchIsPointer "on" MatchDevicePath "/dev/input/event*" # Default value of mouse acceleration: 2/1 4 # Set AccelerationNumerator to zero to disable Option "AccelerationNumerator" "0" Option "AccelerationDenominator" "1" Option "AccelerationThreshold" "4" EndSection $ sudo chmod 644 80-mouse-accel-disable.conf
而已。 您可以注销并重新登录或重新启动。 原则上,鼠标加速度应持久设置为0。
编辑:正如下面的评论之一所示,上述内容可能仅适用于Ubuntu 14.04和派生口味。 在以后的版本中,配置文件语法和关键字可能略有变化,但解决方案的一般原则仍然有效。 请参阅此提示以获取版本16.04和(可能)稍后(未经我测试)。
最简单的方法是简单地禁用整个鼠标加速而不修改它:
使用您选择的编辑器创建以下文件:
$ sudo vim /usr/share/X11/xorg.conf.d/90-mouse-accel-disable.conf
添加以下内容请删除加速配置文件:
Section "InputClass" Identifier "mouse" MatchIsPointer "on" Option "AccelerationProfile" "-1" Option "AccelerationScheme" "none" EndSection
我将发布适用于我的解决方案:(创建配置文件)
首先,您需要在/usr/share/X11/xorg.conf.d/下创建一个名为50-mouse-acceleration.conf的空文件。这可以通过以下命令完成:
sudo gedit /usr/share/X11/xorg.conf.d/50-mouse-acceleration.conf
然后,在此文件中复制以下代码:
Section "InputClass" Identifier "My Mouse" MatchIsPointer "yes" Option "AccelerationProfile" "-1" Option "AccelerationScheme" "none" Option "AccelSpeed" "-1" EndSection
你需要做的最后一件事是用你的鼠标id(用引号)替换标识符“我的鼠标”。 类型
xinput list
从显示的列表中复制鼠标设备的ID。 除此之外,您不必更换任何其他行。 例如,如果您的鼠标ID为12,则完整代码应如下所示:
Section "InputClass" Identifier "12" MatchIsPointer "yes" Option "AccelerationProfile" "-1" Option "AccelerationScheme" "none" Option "AccelSpeed" "-1" EndSection
我希望这有帮助 :)
带有给定参数的xset命令在我的16.04中是未知选项在Ubuntu软件商店中有一个键盘和鼠标的安装程序。 这使得加速变换变得容易。
这对我在ubuntu 18.04上工作,它也适用于ubuntu 16.04 。
由于ubuntu使用gnome,这意味着gnome有时会覆盖xorg.conf.d设置。 Gnome使用dconf ,这是一个“数据库”,其中包含在gnome启动,用户登录等时应用的设置。
这些设置在这里,所以我们( 用户 )不必创建像90-mouse.conf这样的设置,然后调试为什么设置不起作用,搜索日志文件。 一旦gnome用wayland取代xorg,加上设置将保持不变。
如何:
- 安装dconf-editor
sudo apt install dconf-editor
- 打开dconf-editor并转到
org
– >gnome
– >desktop
– >peripherals
– >mouse
这是accel-profile
的设置,它告诉计算机你想要什么样的鼠标加速度。 你有这些选择:
- 默认
- 平坦(用恒定值加速鼠标,又称禁用鼠标加速)
- 自适应
要更改accel-profle
设置:
- 单击
accel-profle
- 如果将“
Use default value
”选项设置为on
打开”,则将其off
- 如果您不想要鼠标加速,请将
Custom value
更改为flat
设置将自动保存。
我的鼠标仍然快! 救命!
您可以降低org/gnome/desktop/peripherals/mouse/speed
该值可以介于-1
和1
之间。