Ubuntu 下基于 fusuma 的触控板多指触控实现

Ubuntu 本身是不能实现两指以上的触控操作的,但是我们可以通过 fusuma 来实现它。


github 地址: https://github.com/iberianpig/fusuma

1. Fusuma 简介

Fusuma是多点触控手势识别器。这个gem使您的linux能够识别滑动捏合并向它们分配命令。
襖(Fusuma)指的是在日本家庭中用来隔开房间的推拉门。
在这里插入图片描述

2. Fusuma 特性

  • 使用RubyGems轻松安装。
  • 在YAML中定义手势和动作。
  • 可设置手势识别灵敏度(阈值、间隔)。
  • 可用于重新连接外部触摸板的自动添加设备。
  • 基于插件系统的手势识别扩展。

3. Fusuma 安装

1.授予读取触摸板设备的权限

提示:您使用的用户必须加入INPUT组才能使用Fusuma 阅读触摸板,这一步就是将当前用户加入INPUT组。

sudo gpasswd -a $USER input

2.安装libinput-tools

需要libinput 1.0版或更高版本。

sudo apt-get install libinput-tools

3.安装Ruby

Fusuma在Ruby中运行.

sudo apt-get install ruby

4.安装 Fusuma

sudo gem install fusuma

5.安装xdotool(可选)

用于发送快捷方式。

sudo apt-get install xdotool

如果触摸板在GNOME中不工作,通过运行以下命令,确保将触摸板事件发送到GNOME桌面:

gsettings set org.gnome.desktop.peripherals.touchpad send-events enabled

4. Fusuma 使用

4.1 启动 Fusuma

fusuma

如果遇到ERROR -- : Touchpad is not found可以试试运行:

sudo fusuma

4.2 更新 Fusuma

sudo gem update fusuma

5. 自定义手势映射

通过编辑~/.config/fusuma/config.yml来自定义手势映射。

如果~/.config/fusuma目录尚不存在,则需要创建该目录。

mkdir -p ~/.config/fusuma        # create config directory
sudo gedit ~/.config/fusuma/config.yml # edit config file.

5.1 可用的手势

  • swipe:
    • 支持34
    • 支持 left:, right:, up:, down: 四个方向
  • 捏合 pinch:
    • 支持234
    • 支持 in:, out:两个方向
  • 旋转 rotate:
    • 支持234
    • 支持clockwise:,counterclockwise:两个方向

5.2 例子

默认设置

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

PS: 重启后设置生效。

5.3 xdotool介绍

6. Fusuma 插件

6.1 Fusuma 插件的作用

  • 添加新手势或组合。
  • 特定Linux发行版的功能。
  • 为每个应用程序设置不同的手势

6.2 Fusuma 插件的安装

Fusuma插件遵循fusuma-plugin-XXXXX命名约定,托管在RubyGems上。

6.3 Fusuma 可用插件

插件名功能
fusuma-plugin-sendkey模拟键盘事件
fusuma-plugin-wmctrl管理窗口和工作区
fusuma-plugin-keypress在按多个键时检测手势
fusuma-plugin-tap检测点击和按住手势

7. Fusuma 开机启动

参考:https://blog.csdn.net/Small_Dong_0_o/article/details/83342228

7.1 创建Fusuma 应用

cd /usr/share/applications &&
sudo touch fusuma.desktop

此时你就可以在/usr/share/applications看到fusuma.desktop的图标了:
在这里插入图片描述
接下来我们就需要编辑这个应用(保持在当前目录):

cd /usr/share/applications &&
sudo gedit fusuma.desktop

填入以下内容:

[Desktop Entry]
Encoding=UTF-8
Name=fusuma
Comment=fusuma
# 你的fusuma的路径,可通过终端命令 `which fusuma`找到
Exec=/usr/local/bin/fusuma
# 这里是你的fusuma的图标,随便找一个就行
Icon=/usr/share/icons/fusuma.png
# 软件打开时是否启动终端,这里选择false
Terminal=false  
StartupNotify=false
Type=Application
Categories=Application;Development;

在这里插入图片描述
你可以双击图标打开软件,可以打开则安装成功。
在这里插入图片描述

7.2 设置开机启动

打开tweak,如果没有在软件商店中搜索安装:
在这里插入图片描述
fusuma添加到开机启动:
在这里插入图片描述
然后就大功告成了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值