如果您曾经使用过MacBook(或者如果您使用的Windows 10笔记本电脑带有兼容的触摸板),您就会知道触控板手势可以用来改变桌面,显示所有打开的窗口以及缩小缩放功能。 除了视觉效果之外,这些工具比键盘快捷键更直观,因此可以提高我们的生产率。

不幸的是,这些手势默认情况下在主要的Linux发行版中不可用。 但是要感谢Kohei Yamada(他使用Ruby开发了Fusuma应用程序)来识别Linux触控板上的多点触摸输入,因此可以轻松地将快捷方式配置为不同的手势。
以下教程基于Fusuma项目的自述文件,将教您如何在Ubuntu 16.04中设置Unity和GNOME的环境(它也适用于Ubuntu 18.04,但是如果您使用Wayland而不是Xorg,则可能会发现一些问题。 )。
Fusuma还可以在其他基于Ubuntu的发行版中工作,例如Elementary OS。
安装Fusuma
首先,您的用户必须是输入组的成员,以便应用程序可以读取触摸板输入。 如果您的用户不是成员,或者您不知道这是什么意思,请在终端中运行以下命令:
sudo gpasswd -a $USER input
您必须注销并再次登录才能使更改生效。
然后,您将安装libinput-tools和xdotool 。 为此,请运行以下命令:
sudo apt-get install libinput-tools
sudo apt-get install xdotool
现在,安装应用程序Fusuma:
gem install fusuma
配置手势
在主目录中,转到文件夹~/.config并在其中创建文件夹fusuma 。 现在,您必须创建一个文件config.yml ,在其中声明所需的快捷键和手势。 经过一些测试,我发现了一组手势配置,这些手势配置最适合我,并且动作流畅,精确。 这些是我为config.yml找到的最佳设置:
文件夹路径必须全部小写,因为它区分大小写。
对于Unity:
swipe:
3:
left:
command: 'xdotool key alt+Right'
right:
command: 'xdotool key alt+Left'
up:
command: 'xdotool key super+w'
down:
command: 'xdotool key Escape'
4:
left:
command: 'xdotool key ctrl+alt+Right'
right:
command: 'xdotool key ctrl+alt+Left'
up:
command: 'xdotool key ctrl+alt+Down'
down:
command: 'xdotool key ctrl+alt+Up'
pinch:
in:
command: 'xdotool key ctrl+plus'
out:
command: 'xdotool key ctrl+minus'
threshold:
swipe: 0.4
pinch: 0.4
interval:
swipe: 0.8
pinch: 0.1
要启动程序并测试是否一切正常,请在终端中运行以下命令:
fusuma
这些是手势和相应的动作:

如果您收到有关触摸板输入的错误消息,并且想要在重新启动计算机之前测试fusuma是否正常运行,则可以以超级用户身份运行它:
sudo fusuma。
对于GNOME:
swipe:
3:
left:
command: 'xdotool key alt+Right'
right:
command: 'xdotool key alt+Left'
up:
command: 'xdotool key super'
down:
command: 'xdotool key super'
4:
left:
command: 'xdotool key ctrl+alt+Down'
right:
command: 'xdotool key ctrl+alt+Up'
up:
command: 'xdotool key ctrl+alt+Down'
down:
command: 'xdotool key ctrl+alt+Up'
pinch:
in:
command: 'xdotool key ctrl+plus'
out:
command: 'xdotool key ctrl+minus'
threshold:
swipe: 0.4
pinch: 0.4
interval:
swipe: 0.8
pinch: 0.1
要启动程序并测试是否一切正常,请在终端中运行以下命令:
fusuma
这些是手势和相应的动作:

如果您使用的是GNOME桌面,但没有任何反应,则必须确保已接收到Touchpad事件:
gsettings set org.gnome.desktop.peripherals.touchpad send-events enabled
注销并重新登录,以使更改生效并再次运行Fusuma。
如果您收到有关触摸板输入的错误消息,并且想要在重新启动计算机之前测试fusuma是否正常运行,则可以以超级用户身份运行它:sudo fusuma。
在启动时启动Fusuma
对于Unity:
在Unity菜单上,搜索“ Startup Applications 。

打开程序,然后单击添加按钮。

在名称字段中写入Fusuma ,在命令字段中写入Fusuma 。

现在您可以重新启动计算机,并且Fusuma将在您登录后立即运行。
对于GNOME:
在GNOME菜单上,搜索Startup Applications 。

打开程序,然后单击添加按钮。

在名称字段中写入Fusuma ,在命令字段中写入Fusuma 。

现在您可以重新启动计算机,并且Fusuma将在您登录后立即运行。