How to enhance touch pad gestures in Ubuntu 18.04 laptop

Viran Malaka
4 min readOct 17, 2018

--

Didn’t you installed newest Ubuntu version 18.04 or 16.04?

If not this article is not for you. If you are using any other Linux distributing with Gnome desktop, you probably can try this out. In this article, I am using Ubuntu 18.04.

You may have seen in MacBook or Windows laptop with a fully compatible touchpad, can do some advanced operations by moving your fingers on the touchpad. Here I guide you, how to add touch pad gestures to do some common tasks like change desktops, move around the applications etc.

Unfortunately, Ubuntu by itself does not have this kind of features. We have to use another magical tool to enable them. Fusuma is a small tool written in Ruby and we are going to install it and use. Here is the repository if you want to know more about it.

Install

We have to make our tool that can be readable the system touch-pad inputs. If your user is not a member of the input group or even you have not heard it before this, just run the following script.

$ sudo gpasswd -a $USER input

This will ask your password. Type your password and press enter.

To apply this change you should log out and login again.

Now we are going to install an input device management and event handling tool called libinput-tools and a simple tool to create fake input from the mouse and keyboard called xdotool . This tool can simulate keyboard input and mouse activities like move and resize windows etc. Execute following scripts to install them

$ sudo apt-get install libinput-tools$ sudo apt-get install xdotool

Now, you may not familiar with Ruby or RubyGem. We are going to use gem installer to install our golden tool. But first you have to install gem if you have not already install it.

$ sudo apt-get install ruby

Now install fusuma.

$ sudo gem install fusuma

If all above command run competently, you can now start creating configuration for gestures. Execute following scripts

$ cd                         # go to HOME dir
$ cd .config # go to user config dir
$ mkdir fusuma && cd fusuma/ # create and cd in to fusuma dir
$ nano config.yml # create config file and edit it

Here I used nano as the text editor, you can use your favorite one for edit this configuration file (eg: gedit config.yml ). Past following code.

swipe:
3:
left:
command: 'xdotool key alt+Shift+Tab'
right:
command: 'xdotool key alt+Tab'
up:
command: 'xdotool key super'
down:
command: 'xdotool key super'
4:
left:
command: 'xdotool key alt+Left'
right:
command: 'xdotool key alt+Right'
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

Then save and exit. For nano :Ctrl + x and then y .

Now you can test what you did until now. Run fusuma to execute our magical application. Is there any error occur while executing?… try sudo fusuma

Wait…. What do I try now….

What you can do now? Try 3 fingers up or down, open activity search. The following list will have all the commands.

3 fingers -> up, down           - Open Activity Search
3 fingers -> left, right - Switch between opened application
(alt + tab)
4 fingers -> up, down - Go around the desktops4 fingers -> left - Go back in browser
4 finters -> right - Go forward in browser
2 fingers -> pinch in or out - Zoom in or out(Those configurations are defined in the config.yml and when you look at that file, you can see the key combination fire when the touch pad gesture. If you want to add another key combination you can put replace it between the quotes.)

Do we want to manually execute this fusuma command every time we login to the computer. No there is a solution. We can add this command to our startup application list. Here is how you can do that.

Open Startup Application tool by search in the application menu as Startup Application and the click Add button. Set the values as follows. Command is the only thing you should put exactly as follows.

Name :    fusuma touch gestures (anything you want)
Command : fusuma
Comment : Touch Pad (anything you want)

Here is the screenshots.

Open Startup Applications
Add New Application

Done…

If you have any issues feel free to contact me on the comment area.

Thank you so much.

--

--