Multi-Touch Gestures on Linux: Easy Setup Guide
In this article
You can add and configure multi-touch gestures on Linux using libinput-gestures or Touchégg. These tools let you swipe, pinch, and tap with multiple fingers to trigger actions like switching workspaces, minimizing windows, or controlling media. The easiest way is to install Touchégg, which has a graphical configurator, but libinput-gestures is more flexible for advanced users. Below are step-by-step instructions for both, plus troubleshooting and tips.
What You'll Need
- A Linux distribution (Ubuntu, Fedora, Arch, etc.) with an X11 session (Wayland support is limited; see FAQ).
- A laptop touchpad or external touchpad that supports multi-touch (most modern ones do).
- Root/sudo access to install packages.
- For libinput-gestures: the
xdotoolpackage (for simulating key presses) andwtypeif you're on Wayland (though libinput-gestures mainly works on X11). - Internet connection to download packages.
Step-by-Step
Option A: Using Touchégg (Easiest, with GUI)
- Install Touchégg – On Ubuntu/Debian, open a terminal and run:
sudo apt install touchegg. On Fedora, usesudo dnf install touchegg. For Arch,sudo pacman -S touchegg. If not in your repos, download the .deb or .rpm from the official GitHub releases page (search "Touchégg releases"). - Start Touchégg – After installation, start it from your application menu or run
touchegg &in a terminal. It runs in the background. - Open the configuration GUI – Touchégg comes with a graphical configurator. Launch it from your app menu (look for "Touchégg GUI") or run
touchegg-uiin a terminal. If the GUI isn't installed, install it withsudo apt install touchegg-ui(or equivalent). - Configure gestures – In the GUI, you'll see a list of gestures (e.g., "Swipe up with 3 fingers", "Pinch out"). Click on a gesture, then choose an action from the dropdown (like "Switch to next workspace", "Minimize window", or "Send key combination"). You can also set a custom command.
- Apply and test – Click "Apply" and test the gesture on your touchpad. If it doesn't work, check that Touchégg is running (look for the icon in your system tray).
Option B: Using libinput-gestures (More Flexible, Text Config)
- Install dependencies – Open a terminal and install
xdotool(for X11) andwtype(if you're on Wayland, though libinput-gestures is primarily for X11). On Ubuntu:sudo apt install xdotool wtype. On Fedora:sudo dnf install xdotool wtype. - Install libinput-gestures – Clone the repository and run the install script:
git clone https://github.com/bulletmark/libinput-gestures.git, thencd libinput-gesturesandsudo make install. - Add your user to the input group – Run
sudo gpasswd -a $USER input. This gives your user permission to read touchpad events. Log out and back in for this to take effect. - Create a configuration file – Copy the default config:
cp /etc/libinput-gestures.conf ~/.config/libinput-gestures.conf. Edit it with any text editor. - Define your gestures – In the config file, each line defines a gesture. For example, to switch workspaces with a three-finger swipe up, add:
gesture swipe up 3 xdotool key super+Page_Up. To minimize the current window with a three-finger tap, add:gesture tap 3 xdotool key super+h. You can also usewtypefor Wayland, but note that libinput-gestures is not fully supported on Wayland. - Start libinput-gestures – Run
libinput-gestures-setup startto start it. To make it start automatically on login, runlibinput-gestures-setup autostart. - Test your gestures – Try the gestures you defined. If they don't work, check the troubleshooting section below.
Common Mistakes
- Not adding user to input group – For libinput-gestures, if you skip step 3, the tool won't have permission to read touchpad events, and gestures will silently fail.
- Using the wrong gesture syntax – In libinput-gestures, the syntax is
gesture [swipe|pinch|tap] [direction] [finger_count] [command]. A common mistake is omitting the finger count or using an invalid direction (e.g., "left" instead of "right"). - Conflicting with existing touchpad settings – Some desktop environments (like GNOME) have built-in gestures that may conflict. Disable those in your system settings if gestures trigger twice.
- Running on Wayland – Touchégg works on Wayland, but libinput-gestures does not. If you're on Wayland, stick with Touchégg or switch to X11 session.
Tips
- Start with three-finger gestures – They are the most common and less likely to trigger accidentally.
- Use xdotool for key combinations – You can bind gestures to any key combination, like
xdotool key ctrl+alt+Leftto switch workspaces. - Test with a single gesture first – Add one gesture, test it, then add more. This makes it easier to isolate problems.
- Check your touchpad's multi-touch support – Use
libinput list-devicesto see if your touchpad supports multi-touch (look for "Touchpad" and "Multitouch" capabilities). - Use the GUI for Touchégg – The GUI is much easier for beginners; you can see exactly what each gesture does.
Troubleshooting
- Gestures not working at all – First, restart the gesture daemon: for Touchégg, run
killall touchegg && touchegg &. For libinput-gestures, runlibinput-gestures-setup restart. Then check if the daemon is running withps aux | grep toucheggorps aux | grep libinput-gestures. - Permission errors – If you see "Permission denied" in logs, you likely forgot to add your user to the input group. Run
sudo gpasswd -a $USER inputand log out/in. - Gestures work but trigger wrong actions – Double-check your config syntax. For libinput-gestures, ensure the command is correct (e.g.,
xdotool key super+Page_Up). For Touchégg, verify the action in the GUI. - Only some gestures work – Some touchpads have limited multi-touch support. Check with
libinput debug-eventsto see if the touchpad sends the events. If not, your hardware may not support that gesture. - Conflicts with desktop environment – If gestures trigger twice, disable the built-in gestures in your system settings (e.g., GNOME's "Workspaces" settings).
- Touchégg GUI not opening – Ensure you installed the
touchegg-uipackage separately. If not, runsudo apt install touchegg-ui(or your distro's equivalent).
Frequently Asked Questions
Does this work on Wayland?
Touchégg works on Wayland, but libinput-gestures does not (it relies on X11). If you're on Wayland, use Touchégg. For libinput-gestures, you need to switch to an X11 session (usually available at the login screen).
Can I use these gestures on a desktop with a mouse?
No, these tools are for touchpads only. For a mouse, you'd need a different tool like easystroke for mouse gestures, but that's not multi-touch.
How do I remove a gesture?
For Touchégg, open the GUI, select the gesture, and delete it or set it to "None". For libinput-gestures, comment out the line in the config file (add # at the start) and restart the daemon.
Can I configure different gestures for different applications?
Touchégg allows per-application gestures (you can set a gesture to only work in a specific app). libinput-gestures does not have this feature natively; you'd need to write a script that checks the active window.
Why do my gestures sometimes trigger accidentally?
This can happen if you have a low threshold. In Touchégg, you can adjust the sensitivity in the GUI. For libinput-gestures, you can edit the config file to require a longer swipe distance or a longer press time.
Is it possible to use four-finger gestures?
Yes, both tools support up to four fingers (or more, depending on your touchpad). Just specify the finger count in the config or GUI.