Archives For touchpad gestures

The built-in touchpad gestures refuse to work after switched to Xorg session in Ubuntu 22.04? Here’s how to re-enable this feature in 2 ways.

The GNOME desktop introduced cool 3-finger touchpad gestures to switch desktop and trigger overview since v40. However, it only works on Wayland session.

Ubuntu 22.04 defaults to GNOME 42 on Wayland. For some reasons, user may need to switch back the classic Xorg session, which however miss the multi-touch gestures support.

Method 1: Use touchegg & X11 gestures extension

Touchégg is a free and open-source Linux multi-touch gesture recognizer. Using it along with an extension can get totally same 3-finger gestures in Xorg:

  • 3-finger up/down to trigger ‘Activities’ overview, or go back.
  • 3-finger left/right to switch desktop workspaces.

1. Firstly, install Touchegg

The software package is available in Ubuntu repository, which however is old and does not work in my case. So, the steps below will tell you how to install it from its official Ubuntu PPA.

a.) Press Ctrl+Alt+T on keyboard to open terminal. When it opens, run the command below to add the PPA:

sudo add-apt-repository ppa:touchegg/stable

Type user password when it asks and hit Enter to continue.

b.) After adding the PPA, install touchegg via command:

sudo apt install touchegg

Ubuntu now updates package cache automatically while adding PPA, if not, run sudo apt update command to do it manually.

After installation, touchegg should run silently as a background service. To verify it, run command:

systemctl status touchegg.service

2. Install X11 gestures extension

Once touchegg service is running, you can install the X11 gestures extension to enable the 3-finger gestures! To do this in Ubuntu 22.04, follow the steps below one by one.

a.) Firstly, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to install Extension Manager app:

sudo apt install gnome-shell-extension-manager

b.) Next, click top-left ‘Activities’ and then search for and launch the tool from overview screen.

c.) Finally, navigate to “Browse” tab, search for and install “X11 gestures” extension.

3-finger gestures work immediately after properly installed Touchégg and X11 gestures extension in my case. If not for you, try log-out and back in or restart your computer.

How to Uninstall Touchégg and X11 gestures extension:

To remove the software package, simply run the command below in a terminal window (Ctrl+Alt+T):

sudo apt install remove --autoremove touchegg

And, remove the PPA via command:

sudo add-apt-repository --remove ppa:touchegg/stable

For the extension, remove it via Extension Manager installed via the previous step.

Method 2: GNOME X11 gesture daemon + Gesture Improvements extension

If the default 3-finger gestures is not enough, then the “Gesture Improvements” extension adds more:

  • 3-finger left/right switch app windows, just like Alt+Tab shortcut does.
  • 3-finger up/down resize current app window.
  • 4-finger up/down and left/right to trigger overview and switch workspaces.
  • 3-finger and 4-finger pinch gestures.
  • And per-app gestures.

1. Install GNOME X11 gesture daemon

The extension works in both Wayland and Xorg sessions. For the latter, the GNOME X11 gesture daemon is required.

a.) Firstly, download the daemon package from its github releases page:

b.) Then, extract the zip in file manager. Right-click on result folder and select “Open in Terminal”:

c.) The context menu option will open a terminal window and automatically navigate to the folder as working directory. After that, run command to add current user to ‘input’ group:

sudo usermod -aG input $USER

Then, run the installer script to install the daemon:

sh install.sh --restart

After installation, it should run silently in background as a user level service. To verify, run command:

systemctl --user status gesture_improvements_gesture_daemon.service

2. Install Gesture Improvements extension:

Like “Method 1”, you may install the extension manager firstly by running command in terminal (Ctrl+Alt+T):

sudo apt install gnome-shell-extension-manager

Then, search for and install “Gesture Improvements” via Extension manager tool.

You can finally configure the extension preferences under “Installed” tab:

‘Gesture Improvements’ extension preferences

NOTE: Method 2 needs a system restart to make multi-touch gestures work in my case.

Uninstall:

To remove the daemon package, re-do step “b.)” to open terminal and run the uninstall script:

sh uninstall.sh

And remove “Gesture Improvements” via Extension Manager tool.

This simple tutorial shows how to enable 3-finger & 4-finger multi-touch gestures in Ubuntu 22.04, Fedora 36 and other Linux with GNOME 40+, while the desktop by default supports only few gestures.

Default multi-touch gestures:

For laptop or desktop PC with a touchpad, the GNOME desktop has out-of-the-box multi-touch gestures support since version 40. However, it only supports few 3-finger gestures.

System default gestures are:

  • 3-finger left/right to switch between workspaces.
  • 3-finger up to go to activities overview and again to app grid.
  • and 3-finger down back to desktop from overview.

More gestures via extension:

The default gestures are working great in my case. But there is “Gesture Improvements” extension available to enable 4-finger swipe, pinch, and per app gestures.

With the extension, overview and workspace switching will use 4-finger gestures instead:

  • 4-finger swipe left/right switching workspaces.
  • 4-finger swipe up navigating activities overview, app grid and desktop. And, 4-finger down to go back.

3-finger left/right touchpad gesture now navigates between app windows in current workspace, just like the “Alt+Tab” keyboard shortcut does. And, 3-finger up/down can be used to resize focused app window: full-screen, maximize, restore, and minimize.

It as well provides 3-finger and 4-finger pinch gestures to do ‘Show Desktop’, ‘Close Window’, or ‘invoke Ctrl+W’ shortcut.

‘Gesture Improvements’ extension settings

Per app gestures is also supported, which can do PageUp/Down, switch tab, go forward/backward, or audio next/previous action for certain applications.

Configure App Gestures

By enabling this feature, you can tap and hold with 3 fingers, then swipe left/right on your app to trigger the action. There will be a blue circle with arrow in it appear in either left or right, indicates that app gesture is triggered.

hold swipe on-screen indicator

The extension also provides settings for touchpad swipe/pinch speed, pop-up delay, and duration between hold and swipe, etc.

How to Install ‘Gesture Improvements’ Extension:

The extension should work on all Linux with GNOME 40, 41 and 42. User may install it by turning on the slider icon on this web page.

Though Ubuntu 22.04 user may follow the steps below to get the extension:

1.) Press Ctrl+Alt+T on keyboard to open terminal. When it opens, run the command below to install extension manager app:

sudo apt install gnome-shell-extension-manager

2.) Once installed, click top-left “Activities”, then search for and open the tool:

3.) When the app opens, navigate to “Browser” tab, search for “Gesture Improvements” and click install the extension from result:

4.) Finally, switch back to “Installed” tab and click the gear button to configure the extension for multi-touch gestures.

NOTE: the extension works immediately after installation on the default Wayland session. If you’re running Ubuntu on classic Xorg, then you need to install this X11 gesture daemon.

For laptop users, the built-in touchpad can do more magic by enabling multi-touch gestures. And libinput-gestures is a popular solution besides touchegg.

Libinput-gestures is a free open-source utility that reads libinput gestures from your touchpad and maps them to user customized gestures. Each gesture can be configured to activate a keyboard key combination via xdotool utility.

How to Install libinput-gestures in Ubuntu:

1.) Before getting started, you need to add your user to input group to have permission to read the touchpad device. To do so, open terminal (Ctrl+Alt+T) and run command:

sudo gpasswd -a $USER input

2.) Libinput-gestures replies on xdotool, libinput-tools, and wmctrl. You need to install them by running command:

sudo apt install wmctrl xdotool libinput-tools

3.) Finally download the source tarball, navigate to source folder, and install it by running following commands one by one:

git clone https://github.com/bulletmark/libinput-gestures.git

cd libinput-gestures

sudo ./libinput-gestures-setup install

4.) To make the service automatic starts at login, run command:

libinput-gestures-setup autostart start

Because step 1. needs a system restart to apply change, it may outputs failed to add the service to system start. Just ignore it, and restart your machine.

Configure gestures:

The default configurations locates in /etc/libinput-gestures.conf file. You can open terminal and run command to edit it:

sudo gedit /etc/libinput-gestures.conf

Read the description and change it accordingly.

Hate editing config files? There’s a graphical tool to configure touchpad gestures.

Open terminal and you can run following commands one by one to install the tool via flatpak package:

a.) Install the Flatpak daemon via command:

sudo apt install flatpak

b.) Add the Flathub repository which hosts the app package:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

c.) Finally install the graphical tool via command:

flatpak install flathub com.gitlab.cunidev.Gestures

Once installed, open it from system app launcher and enjoy!

Uninstall Libinput Gestures:

To remove the graphical configuration tool, run command:

flatpak uninstall --delete-data com.gitlab.cunidev.Gestures && flatpak uninstall --unused

To remove the libinput gestures, run command:

sudo libinput-gestures-setup uninstal

This simple tutorial shows how to enable & configure the multi-touch gestures in Ubuntu 20.04, Ubuntu 21.04, Ubuntu 21.10 using touchegg.

For those running Ubuntu on laptop or PC with external touchpad, multi-finger gestures enable users with more actions to control your system.

Since Ubuntu does not offer a utility to configure multi-touch functions, touchegg is a free open-source tool to enable this feature for you. And it supports for both global gestures or gestures for Firefox, Chromium, Google Chrome only.

Touchégg Enables Touchpad Gestures include:

  • Swipe up, down, left, and right with 3 fingers and/or 4 fingers.
  • Pinch in / out with 2, 3, and/or 4 fingers.
  • Tap with 2, 3, 4, and/or 5 fingers.

Actions you can set for touchpad gesture:

  • Minimize, Maximize, Restore, Close a window.
  • Tile a window.
  • Toggle full-screen.
  • Switch desktop.
  • Show desktop.
  • Execute a command.
  • Specify a keyboard shortcut, e.g., to open terminal, switch workspace, toggle activities overview.

Step 1: How to Install Touchégg Service in Ubuntu via PPA:

The software has an official PPA which so far supports for Ubuntu 20.04, Linux Mint 20, and higher.

1.) Firstly open terminal from system application launcher and run command to add the PPA:

sudo add-apt-repository ppa:touchegg/stable

Type user password, no asterisk feedback, when it asks and hit Enter to continue.

2.) Next run command to install the touchegg service via command:

sudo apt install touchegg

The service should run automatically once you installed it. To verify the status, run command:

systemctl status touchegg.service

It should show you ‘active (running)‘. If not, try to enable and start the service:

systemctl status touchegg.service && systemctl start touchegg.service

Step 2: Install Graphical Configuration tool: Touché

UPDATE (Nov 2021): It’s not a good idea in my own opinion, but they did it. The project does no longer provide native DEB package for the graphical configuration tool ‘Touché‘, though still maintains Ubuntu PPA with the package for the Touchégg system service. Some user do not like Flatpak since it requires hundreds of MB runtime libraries, while the app itself is only few dozen MB. For choice, you may use the GNOME Extension instead, see the link in bottom!

Now the project offers the graphical tool via universal Flatpak package runs in sandbox.

1.) Firstly, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to install the flatpak daemon first:

sudo apt install flatpak

2.) Next, run command to install the configuration tool via Flatpak:

flatpak install https://dl.flathub.org/repo/appstream/com.github.joseexposito.touche.flatpakref

Finally restart your system is required to make multi-touch work!

Step 3: Enable/Configure Multi-Touch Gestures

After restarted your system, search for and launch touché from Activities overview. When it opens, enable one or more finger gestures as you prefer. Then choose an action from the drop-down box.

Turn on the slider icons as you prefer, and select an action to do from the drop-down box. You may also simulate a keyboard shortcut, such as “Super” key to toggle overview and “Super+Pageup/Pagedn” to switch workspace.

The changes in touche apply immediately. And there’s also Gnome Extension to enable multi-touch gestures on X11. For more, see touchegg on github.

Uninstall Touchégg:

To remove the Touchégg service, open terminal and run command:

sudo apt remove --autoremove touchegg

And remove the Ubuntu PPA via command:

sudo add-apt-repository --remove ppa:touchegg/stable

For the graphical configuration tool Touché, remove it via command:

flatpak uninstall --delete-data com.github.joseexposito.touche

You may also run flatpak uninstall --unused to clean up disk space.