macbook 最吸引人之处就在于他的触控板,三指、四指各式操作让日常的生活、办公无比便捷,而如今,各个 windows 笔记本厂商也纷纷支持多点触控,发挥出了触摸板的优势。 那么,在 linux 下,我们是否也可以实现上述便捷的操作呢?当然是可以的,本文就来介绍一下。
开源软件 fusuma 实现了多点触控的自定义配置: https://github.com/iberianpig/fusuma。
fusuma 的安装并不复杂。
首先,要让系统能够识别到你的触摸板,而普通用户是不具备自定义输入的权限的,因此需要执行下面命令让你成为输入组的一员:
sudo gpasswd -a $USER input
当然,如果你最终要通过 root 用户启动 fusuma,那么你无需进行这一步操作。
fusuma 是通过 ruby 编写的,因此需要安装 ruby 环境。
sudo apt install libinput-tools sudo apt install xdotool sudo apt install ruby
sudo gem install fusuma
gsettings set org.gnome.desktop.peripherals.touchpad send-events enabled
fusuma 遵循 XDG Base Directory 规范,他的配置文件位于 ~/.config/fusuma
目录下,因此执行下面命令创建配置文件:
mkdir -p ~/.config/fusuma # create config directory touch ~/.config/fusuma/config.yml # edit config file.
编辑上面创建的配置文件即可实现以下功能:
left
、right
、up
、down
进行配置in
、out
进行配置clockwise
、counterclockwise
进行配置swipe:
3:
left:
command: "xdotool key alt+Right" # History forward
right:
command: "xdotool key alt+Left" # History back
up:
command: "xdotool key super" # Activity
down:
command: "xdotool key super" # Activity
4:
left:
command: "xdotool key ctrl+alt+Down" # Switch to next workspace
right:
command: "xdotool key ctrl+alt+Up" # Switch to previous workspace
up:
command: "xdotool key ctrl+alt+Down" # Switch to next workspace
down:
command: "xdotool key ctrl+alt+Up" # Switch to previous workspace
pinch:
in:
command: "xdotool keydown ctrl click 4 keyup ctrl" # Zoom in
out:
command: "xdotool keydown ctrl click 5 keyup ctrl" # Zoom out
如果你需要支持更为复杂的手势操作,或者通过触摸板模拟键盘事件等,都可以通过安装 fusuma 的插件实现:
sudo gem install fusuma-plugin-XXXXX
可以参考:
https://github.com/iberianpig/fusuma。