0%

ubuntu 自定义触控板手势

描述:ubuntu的触控板手势不多,最高只支持两点触控,白白浪费了触控板这四点触控。偶然在知乎上看到有人用一个软件xSwipe 成功实现多点触控,实测可以自行调节所需手势,我在安装过程中遇到一些麻烦,这里记录下来,作为备用。

xSwipe在开源项目网站GitHub上可以找到,传送门,或访问 https://github.com/iberianpig/xSwipe PS:由于服务器在国外,国内访问可能很慢,我将所需文件备份了一份,下载地址放在文章末尾了。

官网上的说明文档是英文版,虽然推荐读者阅读原版文档,但是为了照顾英语不好的同志,我找了一篇中文博客(点我访问),安装过程这篇博客已经说得很清楚了,这里不再叙述。 下面贴出官方的说明文档:

xSwipe

xSwipe is multitouch gesture recognizer. This script make your linux PC able to recognize swipes like a Macbook.

Usage

Before running the script, you must first do some preparations.

1: Download xSwipe
2:Install X11::GUITest
3:Enable SHMConfig

1. Download xSwipe

Type below code, download xSwipe from github

$ cd ~
$ wget https://github.com/iberianpig/xSwipe/archive/master.zip
$ unzip master.zip

2. Install X11::GUITest

To install libx11-guitest-perl from synaptic package manager Or run the script on the terminal run as

$ sudo apt-get install libx11-guitest-perl
NOTE: If using Ubuntu14.04, or later
Install older version synaptics driver that is compatible with xSwipe.
$ sudo apt-get install -y git build-essential libevdev-dev autoconf automake libmtdev-dev xorg-dev xutils-dev libtool
$ sudo apt-get remove -y xserver-xorg-input-synaptics
$ git clone https://github.com/Chosko/xserver-xorg-input-synaptics.git
$ cd xserver-xorg-input-synaptics
$ ./autogen.sh
$ ./configure --exec_prefix=/usr
$ make
$ sudo make install

3. Enable SHMConfig

Open /etc/X11/xorg.conf.d/50-synaptics.conf with your favorite text editor and edit it to enable SHMConfig

$ sudo gedit /etc/X11/xorg.conf.d/50-synaptics.conf  

NOTE:You will need to create the /etc/X11/xorg.conf.d/ directory and create 50-synaptics.conf if it does’nt exist yet. $ sudo mkdir /etc/X11/xorg.conf.d/

/etc/X11/xorg.conf.d/50-synaptics.conf
Section “InputClass”
Identifier “evdev touchpad catchall”
Driver “synaptics”
MatchDevicePath “/dev/input/event*”
MatchIsTouchpad “on”
Option “Protocol” “event”
Option “SHMConfig” “on”
EndSection
To reflect SHMConfig, restart your session.

That’s it for preparation.

Run xSwipe

To run xSwipe, type below code on terminal.

$ perl ~/xSwipe-master/xSwipe.pl
Note:You should run xSwipe.pl in same directory as "eventKey.cfg" .

You can use “swipe” with 3 or 4 fingers, they can call an event. Additionally, some gestures are avilable.

edge-swipe : swipe with 2 fingers from outside edge(need to enable with option).
long-press : hold pressure for 0.5 seconds with 3 or 4 fingers.

Option

-d RATE : RATE is sensitivity to swipe.Default value is 1. Shorten swipe-length by half (e.g.,$ perl xSwipe.pl -d 0.5)
-m INTERVAL : INTERVAL is how often synclient monitor changes to the touchpad state. Default value is 10(ms). Set 50ms as monitoring-span. (e.g.,$ perl xSwipe.pl -m 50)
-n : Natural scroll like Macbook, use “/nScroll/eventKey.cfg”.
-e : Enable edge-swipe

Customize

You can customize the settings for gestues to edit eventKey.cfg. Please check this article, “How to customize gesture”.

Bindable gestures

3/4/5 fingers swipe
2/3/4/5 fingers long-press
2/3/4 fingers edge-swipe
2fingers edge-swipe: only swipe-left/right from right/left edge
3fingers edge-swipe: only swipe-down from top egde

Example shortcut keys

go back/forward on browser (Alt+Left, Alt+Right)
open/close a tab on browser (Ctrl+t/Ctrl+w)
move tabs (Ctrl+Tab, Ctrl+Shift+Tab)
move workspaces (Alt+Ctrl+Lert, Alt+Ctrl+Right, Alt+Ctrl+Up, Alt+Ctrl+Down)
move a window (Alt+F7)
open launcher (Alt+F8)
open a terminal (Ctrl+Alt+t)
close a window (Alt+F4)
Please let me know if you have any questions about this program.

我按照说明文档安装好所需软件之后,进行到最后一步

$ perl ~/xSwipe-master/xSwipe.pl

遇到错误提示:
“Can’t locate Smart/Comments.pm in @INC (you may need to install the Smart::Comments module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /home/jackson/xSwipe-master/xSwipe.pl line 15.”

百度无果,最后还是google给了我答案 可以访问原文地址:https://forum.teksyndicate.com/t/perl-smart-comments/86880

做法是,在终端键入下列命令:

sudo cpan -i Smart::Comments

等待完成即可,不出意外的话,通过命令:

$ perl ~/xSwipe-master/xSwipe.pl

就可以开启三点以上触控板手势了,可以根据需要自行更改eventKey.cfg的内容来获得自己想要的手势。

xSwipe下载http://pan.baidu.com/s/1gesqHm7

此文章仅作参考使用,使用时请仔细阅读说明文档。

我使用的操作系统为 ubuntu 14.04 LTS