Assign Actions To Touchpad Gestures On Linux With Touchegg

Touchegg touchpad multi-touch gestures Linux

Touchegg, a multi-touch gesture recognizer for Linux that was first released back in 2011, and which haven't been updated in years, was completely rewritten about 2 months ago "to incorporate the new technologies that are available today on the Linux desktop". Since then there have been 3 other releases which added new features along with bug fixes. 

The application runs in the background, transforming the multi-touch gestures you make on your touchpad into various desktop actions. For example, you can minimize a window by swiping down using 3 fingers, pinch in using 2 fingers to zoom in, etc. 

This is a demo video recorded by the Touchegg developer (image above credits also go to the dev):

All supported gestures are configurable, but there's no graphical user interface, so to tweak the application you must edit a configuration file. [[Edit]] The Touchegg developer has created a GUI for configuring Touchegg, called Touche.

Since the rewrite, Touchegg has added libinput support, and it can use swipe and pinch multi-touch gestures ([[edit]] in a new release, the application has added support for tap gestures on touchscreens) with the following actions:

  • Maximize / restore window
  • Minimize window
  • Tile window
  • Close window
  • Change desktop
  • Show desktop
  • Send a keyboard shortcut
  • Send mouse clicks
  • Run command

The gestures can be global (for all applications), or for specific applications. You can find the default actions and assigned multi-touch gestures here.

It's worth mentioning that on touchpads, swipe gestures are executed when a minimum of three or more fingers are moved synchronously in the same direction. The minimum fingers for swiping on touchscreens is two. As for pinch gestures, they are executed when two or more fingers are located on the touchpad and are either changing the relative distance to each other (pinching) or are changing the relative angle (rotate).

You might also like: How To Bind Mouse Buttons To Keyboard Keys Or Commands (Linux Using X11)

The application has also added animations, so the gestures don't feel like a shortcut anymore. These animations should be smooth even on devices with limited resources, like the Raspberry Pi 4. 

Yet another feature added recently is support for touchscreens. So you can now use pinch and swipe gestures on your touchscreen with the help of Touchegg.

It's also worth noting that Gala, the default Elementary OS window and compositing manager based on libmutter, will get multi-touch gesture support by integrating Touchegg.

Downloading and using Touchegg

The Touchegg GitHub releases page has DEB (for Debian, Ubuntu, Linux Mint, Pop!_OS, Zorin OS, etc.) and RPM (Fedora, Red Hat, CentOS, etc.) binaries for download. There's also an Arch Linux package available on AUR, although it's a bit out of date at the time I'm writing this article.

After you install Touchegg, reboot the system or run touchegg in a terminal window (so the Touchegg client connects to the daemon) and try out some gestures. The Touchegg client is automatically added on startup, so on subsequent reboots it should start automatically.

To configure Touchegg, copy its global configuration file to your user's config directory:

mkdir -p ~/.config/touchegg

cp /usr/share/touchegg/touchegg.conf ~/.config/touchegg/

Next, open ~/.config/touchegg/touchegg.conf with a text editor, and edit the application settings and gestures / actions to suit your needs. Or you can use Touche, a GUI to configure Touchegg gestures.