虽然 Wayland 下已经内置了触摸板手势支持,但是 Wayland 还没法用,至少鼠标在高负载下的卡顿问题还没解决,所以我们还是说说 Xorg 的支持好了。

如果是 Wayland 的话直接装一个插件就可以了:

https://extensions.gnome.org/extension/2781/custom-3-finger-gestures/

在 Xorg 下使用触摸板手势需要安装 Libinput-gestures

https://github.com/bulletmark/libinput-gestures

首先添加你的用户进 input 组:

sudo gpasswd -a $USER input

然后安装编译依赖:

sudo apt-get install libinput-tools xdotool

接着就是安装了,如果依赖有缺少,可以自己补充:

git clone https://github.com/bulletmark/libinput-gestures.git
cd libinput-gestures
sudo make install
sudo ./libinput-gestures-setup install

然后设置为自动启动:

libinput-gestures-setup autostart
libinput-gestures-setup start

你也可以手动用终端运行一下 libinput-gestures-setup 看看有没有报错,一般来说会说没有权限,确保你做了第一步,添加用户进 Input 组,而且添加后注销是没用的,需要重启

当你确定你的 libinput-gestures-setup 可以运行的时候,你就可以安装手势管理软件了。

git clone https://gitlab.com/cunidev/gestures
cd gestures
sudo python3 setup.py install

就可以看到这个 gestures 工具了,利用 xdotool 来添加你对应的操作:

Screenshot-20200529101735-1858x1706.png

譬如 xdotool key "ctrl+alt+Down" 就是对应的按键,可以根据需求自行发挥。

整体来说这个 libinput-gestures 还是挺灵敏的,只是还是比不上 Wayland 那样可以像 Mac OS 一样即时滑动就是了。

抄袭来源:
How to Enable Mac-like Gestures on Ubuntu 20.04