Add multitouch trackpad gestures on Linux

Subscribers:
390,000
Published on ● Video Link: https://www.youtube.com/watch?v=ArBCfhVsTZw



Duration: 4:10
178,108 views
3,346


I recently set up my new Matebook 13 with some nice touchpad gestures on elementary OS, and it works great. Since I like to share, here is how to enable said gestures, and create them on the fly on your own system. These commands will work on Ubuntu, or anything based on Ubuntu, but you can adapt them for your own distro if needed.

Support the channel on Patreon: https://www.patreon.com/thelinuxexperiment

Follow me on Twitter : http://twitter.com/thelinuxEXP

What I use to make my videos:
Microphone: https://amzn.to/2PsNWXl
GPU: https://amzn.to/2LHZ5o5
Motherboard: https://amzn.to/2KZt63t
CPU: https://amzn.to/2IFjKrw

----------
Libinput-Gestures Link: https://github.com/bulletmark/libinput-gestures

Gestures App Link: https://gitlab.com/cunidev/gestures

List of keycodes: https://gitlab.com/cunidev/gestures/wikis/xdotool-list-of-key-codes

Commands:
sudo gpasswd -a $USER input

sudo apt-get install wmctrl python3 python3-setuptools xdotool python3-gi libinput-tools python-gobject

cd Downloads/libinput-gestures

sudo make install

cd Downloads/gestures

sudo python3 setup.py install


Installing Libinput
To add gestures on Linux, you'll need Libinput-gestures, which is a little library that can detect and recognize the various multitouch gestures on your trackpad.
To install it, the procedure is pretty easy.

First, you'll have to add your user to the INPUT group, so you're allowed to use the gestures. Just open a terminal, and type:

sudo gpasswd -a $USER input

Once you've entered your password, and the command is done, you'll need to log out, and log back in.

Next, let's install some packages we'll need to begin:
In your terminal, type:

sudo apt-get install wmctrl python3 python3-setuptools xdotool python3-gi libinput-tools python-gobject

These packages will allow you to map gestures to specific key presses, and to use an app for creating the gestures.

Then, we'll download and install libinput-gestures.
head to the github page of the project, and download the archive. Extract it to your Downloads folder.

Then, open a terminal, and type:

cd Downloads/libinput-gestures-master
sudo make install

Everything should now be installed correctly. We'll just need to make sure libinput gestures starts with the system, so we'll type in the terminal:

libinput-gestures-setup autostart
libinput-gestures-setup start

Installing the Gestures app
To create your own gestures, there is a handy little app that allows you to select which gesture you want, and the command you want to run when the gesture is detected. It's called "Gestures".

head to the Github page (again, link in the description below), and download the archive. Extract it to your Downloads folder.

Then, in your terminal, type:

cd Downloads/gestures
sudo python3 setup.py install

There you go, now everything is setup, you can safely remove the folders in your downloads directory

Create your gestures
This is the easy part. The app lets you click on the "+" button to create a new gesture. Select the type of gesture: pinch or swipe, the number of fingers, and then the direction of the gesture.
You then have to type the command you want to execute when you do the actual gesture.

To map a gesture to a specific key press, you can use xdotool.
Simply type xdotool key
Then the key combination you want to do.
You can type Super, Control, Alt, or Shift, and then the key you want.

As an example, I created a 3 finger swipe up to launch the multitasking view on elementary OS. I mapped it to the standard elementary shortcut Super + Down.
I just typed xdotool key Super+down

For a list of the codes you can use for each key, head to the link in the description below, and us the keycode in the second column for the key you want to use.ted to create a pinch to zoom gesture, the shortcut to use if Control + Plus. The code for the Plus key is 0x002b

So, you would need to type:

xdotool key Control+0x002b

That's it, once your gestures are saved, they'll load automatically at each system startup, so no need to fiddle anymore :)







Tags:
linux
elementary os
open source
distribution
linux distro
linux help
linux tutorial 2019
Linux 2019
trackpad gestures ubuntu 18.04
linux gestures touchpad
multitouch gestures ubuntu 18.04
multitouch gestures ubuntu
gestures elementary os
elementary os touchpad gestures
linux multitouch gestures
how to add multi touch trackpad gestures to linux
linux gestures
touchpad gestures
ubuntu (operating system)