由于使用 OSX 习惯了, 所以希望 Ubuntu Desktop 使用中鼠标也行是自然方向滚动,以下是实现方法:
14.04 - Mouse wheel scrolls in reversed direction - Ask Ubuntu
查看输入设备列表:
~$ xinput list
输出类似:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ USB OPTICAL MOUSE id=12 [slave pointer (2)]
⎜ ↳ USB OPTICAL MOUSE id=14 [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)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ LiteOn Lenovo Calliope USB Keyboard id=10 [slave keyboard (3)]
↳ LiteOn Lenovo Calliope USB Keyboard id=11 [slave keyboard (3)]
↳ USB OPTICAL MOUSE id=13 [slave keyboard (3)]
其中 USB OPTICAL MOUSE
这个就是 usb 鼠标, 根据我的经验,需要修改的是第二个(id=14
这个).
~$ xinput list-props 14
输出:
Device 'USB OPTICAL MOUSE ':
Device Enabled (166): 1
Coordinate Transformation Matrix (168): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Accel Speed (399): 0.000000
libinput Accel Speed Default (400): 0.000000
libinput Accel Profiles Available (401): 1, 1
libinput Accel Profile Enabled (402): 1, 0
libinput Accel Profile Enabled Default (403): 1, 0
libinput Natural Scrolling Enabled (395): 0
libinput Natural Scrolling Enabled Default (396): 0
libinput Send Events Modes Available (285): 1, 0
libinput Send Events Mode Enabled (286): 0, 0
libinput Send Events Mode Enabled Default (287): 0, 0
libinput Left Handed Enabled (404): 0
libinput Left Handed Enabled Default (405): 0
libinput Scroll Methods Available (406): 0, 0, 1
libinput Scroll Method Enabled (407): 0, 0, 0
libinput Scroll Method Enabled Default (408): 0, 0, 0
libinput Button Scrolling Button (409): 2
libinput Button Scrolling Button Default (410): 2
libinput Middle Emulation Enabled (411): 0
libinput Middle Emulation Enabled Default (412): 0
Device Node (288): "/dev/input/event15"
Device Product ID (289): 6392, 3991
libinput Drag Lock Buttons (397): <no items>
libinput Horizontal Scroll Enabled (398): 1
注意 libinput Natural Scrolling Enabled (395)
这个的值默认是0, 修改为 1, 鼠标的滚轮滚动就是自然方向滚动了:
xinput set-prop 14 395 1
如果报错 Unable to connect to X server
, 运行以下语句即可
export DISPLAY=:0.0