Wed. Dec 4th, 2019

Host your Website

Read and learn

FatCow Web Hosting $1.00/mo* Trust your web hosting to the #1 web host provider, GoDaddy!

Add multitouch trackpad gestures on Linux

3 min read

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:

Follow me on Twitter :

What I use to make my videos:

Libinput-Gestures Link:

Gestures App Link:

List of keycodes:

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 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 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 🙂

49 thoughts on “Add multitouch trackpad gestures on Linux

  1. Heroes don't use cape, I was trying to use the lib-input for a few time, but a never fought that there were an graphical interface for helping me with the gesture thank you.

  2. I don't want to sound nasty and I'm not saying this comment to shit on anyone's cereal, but Linux is still getting these gestures wrong. For example, the "switch between workspaces" gesture should start happening *when you start moving your fingers*, not happen all at once after you've done the gesture.

    If implemented properly, you can even do half a gesture (and get the visual feedback that you're "halfway there") and then move your fingers back to the other direction to undo it

  3. Any distro maintainers could easily package those packages and few commands into their distro. I'm sure it wouldn't take more than a couple of minutes. This and other silly things like, tap to click on lock screen, boot animation and so on. I feel like some developers don't care much because they're not getting paid to do it? Which is understandable, too, but it isn't bad to dream, right? Lol

  4. Multi-touch gestures.
    Windows 10: Just works.
    OSX: Just works.
    Android: Just works.
    Desktop Linux: Type lots of cryptic command-lines and download a bunch of files from Github.

  5. Multi-touch gestures.
    Windows 10: Just works.
    OSX: Just works.
    Android: Just works.
    Desktop Linux: Type lots of cryptic command-lines and download a bunch of files from Github.

  6. First tried libinput-gestures. Then found fusuma and haven't gone back. Mainly because you can tweak thresholds for individual gestures.
    There is a new project called gebaar that gives the ability for diagonal swipes (at the cost of pinch gestures). A new fork was created that allows one to apply thresholds to gestures as well. Hope to try it out again soon.

  7. Linux is few years behind win10 on touchpad gestures support and though Libinput-Gestures isn't GUI and does require wit of "reading and following", I do like 8 gestures (extended) vs win10 4 gestures (last I've checked/used). Win10 gui vs Libinput-Gestures "manual", I found them both equal overall, time to setup.

    Fusuma multitouch is as good, is as easy, though no 8 (extended) gestures.

    18.04.3 LTS ubuntu no issues, flawless. 19.10 good enough but a bit lacking. Less responsive and 3 finger touch wasn't there. (click was)

    FYI sometimes s/w gets updated and might be better/worse on different h/w.

  8. * This method of installation is messy. Someone may created native (debian) package for these tools. Native packages are much more clean and easier to remove.
    * This feature does not work on Wayland. Personally I would not like to use feature which does not work on Wayland because Xorg is legacy and won't be developed in the future.
    * For compatibility with Wayland and general stability this feature should be implemented in compositor (in Wayland terms, in Xorg terms it means "in window manager") or in libinput itself. If you really like it, talk with maintainers of libinput or/and mutter (as I understand elementary's compositor is based on mutter from gnome).

    What I want to say here is: don't use improperly designed solutions which just works. Or, at least, use it until proper solution will be ready but do something to make this happen. As I wrote before, solution shown on the video is broken by design (xorg-specific, not part of the desktop). Talk with maintainers of GNOME and libinput, fill feature request on the bugtracker. Maybe even collect some money using platforms like if someone want to declare to write this feature. But please don't just use broken software, try to make it better also. This is the point of open source software.

  9. Thumbs UP on this video
    Oh… so complicated (it's not easy for sure)
    Im a windows user trying to use linux distros but everytime i quit …after many days of effort..!!
    IF ONLY these gestures would come as a package incuded in a distro.

    So the bottom line is…
    IF you want gestures like mac os or win10 have to be a techie.

    Dont get me wrong ..the video is great and very informative, and @The Linux Experiment are great too.!! Thanks.!!

    ps: before you judge my comment a developer. I hope all this effort of linux enthusiasts some day will become a product "that works out of the box". That will be the time that even my mother will run Ubuntu or Mint in her laptop.
    I RESPECT you all, and i respect your passion and effort.
    I have already subscribed to your channel.

  10. Well, I don’t know if this is Fedora-Specific, but I have some Multitouch-Gestures for switching from Workspace to Workspace and open the Activities build in in Gnome…

    But it’s good to see that’s there are efforts to make it more customizable. However they really should have done a Switchboard-Plugin for Elementary OS…

Comments are closed.

Copyright © All rights reserved. | Newsphere by AF themes.