如何在Debian Gnome的Wayland环境下基于Libinput设置设备专属鼠标灵敏度
我刚好在Wayland环境的Gnome桌面折腾过类似的多输入设备灵敏度配置问题,给你两个可行的解决方案,亲测在Debian 10 Buster上有效:
方案一:用gsettings针对单个设备配置
Wayland下Gnome的外设设置支持单独为每个设备定制参数,步骤如下:
识别设备名称
先运行命令列出所有输入设备:libinput list-devices在输出里找到你的Trackpoint(指点杆,通常名称是
TPPS/2 IBM TrackPoint)和外接微软鼠标,记下它们的完整名称。查看并设置单个设备的灵敏度
首先查看全局鼠标灵敏度(参考用):gsettings get org.gnome.desktop.peripherals.mouse speed这个数值范围是
-1到1,-1最慢,1最快。然后列出系统已识别的外设配置项:
gsettings list-children org.gnome.desktop.peripherals你会看到对应设备的配置项,比如指点杆可能是
org.gnome.desktop.peripherals.tpps-2-ibm-trackpoint,外接鼠标是org.gnome.desktop.peripherals.microsoft-xxx-mouse(名称会根据实际识别结果自动转换为小写加连字符的格式)。分别设置灵敏度:
- 给指点杆设低灵敏度(比如
-0.8,数值可按需调整):gsettings set org.gnome.desktop.peripherals.tpps-2-ibm-trackpoint speed -0.8 - 给外接鼠标设高灵敏度(比如
0.9):gsettings set org.gnome.desktop.peripherals.microsoft-xxx-mouse speed 0.9
设置后立刻生效,不需要重启。如果没找到对应设备的配置项,先操作一下设备(移动指点杆/鼠标),再重新运行
gsettings list-children命令试试。- 给指点杆设低灵敏度(比如
方案二:用libinput底层配置文件(更稳定)
如果gsettings的方法不生效,或者你需要更精细的控制,可以直接用libinput的配置文件:
获取设备的Vendor ID和Product ID
还是用libinput list-devices命令,找到目标设备的Vendor和Product字段,比如指点杆的Vendor: 0x0001,Product: 0x0002,外接鼠标的Vendor: 0x045E,Product: 0x07A5(数值以实际输出为准)。创建自定义配置文件
创建并编辑/etc/libinput/local-overrides.quirks文件(需要sudo权限):sudo nano /etc/libinput/local-overrides.quirks加入以下内容,替换成你自己的Vendor ID、Product ID和灵敏度数值:
[Trackpoint Low Sensitivity] MatchVendor=0x0001 MatchProduct=0x0002 AttrPointerAccel=0.2 [Microsoft Mouse High Sensitivity] MatchVendor=0x045E MatchProduct=0x07A5 AttrPointerAccel=1.5这里
AttrPointerAccel的范围是0到2,0是无加速,2是最大加速,数值越大灵敏度越高。生效配置
保存文件后,重启桌面会话(或者直接重启系统),配置就会生效。这个方法是直接作用于libinput驱动层,对Wayland环境的兼容性更好。
注意:这两个方案都不会影响触控板的灵敏度设置,完全符合你的需求。
内容的提问来源于stack exchange,提问作者Doctor David Anderson

