Linux

Assign Actions To Touchpad Gestures On Linux With Touchegg


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 GIF recorded by the Touchegg developer:

Touchegg demo Linux touchpad gestures

All supported gestures are configurable, but there’s no graphical user interface, so to tweak the application you must edit a configuration file. If you’re looking for a Linux touchpad gestures GUI (Gtk) application, check out Gestures. Or you can use a third-party GUI for Touchegg, like Touchegg-gce.

Since the rewrite, Touchegg has added libinput support, and it can use swipe and pinch multi-touch gestures with the following actions:

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

The gestures can be global (for all applications), or for specific applications.

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.