1. Overview

By setting the touchpad gestures, we can increase the efficiency and accessibility of the operating system by allowing quick navigation between workspaces. Additionally, we can customize gestures to enhance productivity and user experience.

In this tutorial, we’ll explore two tools to manage touchpad gestures in Linux.

2. Using Touchegg

Touchegg is a popular Linux tool that facilitates advanced multitouch gesture support for touchpads. It can also configure gestures to execute custom commands.

2.1. Installation

Before using the Touchegg tool, let’s ensure we’ve installed it in our system.

To install the Touchegg tool in Debian-based systems, we use the apt command:

$ sudo apt install touchegg

Moreover, to install the Touchegg tool in Arch and Arch-based derivatives, we can utilize the pacman command:

$ sudo pacman -S touchegg

Now, let’s verify the installation of the Touchegg tool by opening the tool:

$ touchegg
Reading config from  "/home/ishu/.config/touchegg/touchegg.conf"
Try to make a multitouch gesture. If everything goes well the information about the gesture must appear
[+] Avaliable gesture:
     Name ->  Flick
[+] Avaliable gesture:
     Name ->  Drag
... output truncated...

The output shows that the installation is completed.

2.2. Usage

To add touchpad gestures, the first step is to open the configuration file of the Touchegg tool. Let’s open the configuration file using the nano editor:

$ nano /home/ishu/.config/touchegg/touchegg.conf
<touchégg>
    <settings>
        <property name="composed_gestures_time">0</property>
    </settings>
    <application name="All">
        <gesture type="TAP" fingers="2" direction="">
            <action type="MOUSE_CLICK">BUTTON=3</action>
        </gesture>
        <gesture type="TAP" fingers="3" direction="">
            <action type="MOUSE_CLICK">BUTTON=2</action>
        </gesture>
...output truncated...

Furthermore, we edit the configuration file and add our desired gestures.

Let’s add the three-finger swipe gestures. Using the three-finger swipe gestures, we can swiftly navigate between multiple workspaces. First, we add the three-finger swipe left gesture in the configuration file:

<gesture type="SWIPE" fingers="3" direction="LEFT">
  <action type="RUN_COMMAND">
    <repeat>true</repeat>
    <command>xdotool key ctrl+alt+Left</command>
  </action>
</gesture>

Thus, whenever we swipe left with three fingers on the touchpad, the OS executes the command we set. Moreover, the xdotool key ctrl+alt+Left command imitates pressing the Ctrl, Alt, and Left Arrow keys simultaneously on the keyboard. As a result, the OS switches to the previous workspaces. Furthermore, by setting the repeat option to true, we ensure the OS continues to recognize the gesture.

Similarly, to switch to the next workspace, we can set the swipe right gesture:

<gesture type="SWIPE" fingers="3" direction="RIGHT">
  <action type="RUN_COMMAND">
    <repeat>true</repeat>
    <command>xdotool key ctrl+alt+Right</command>
  </action>
</gesture>

Now, if we swipe right with three fingers on the touchpad, we can easily move to the next workspace.

The next touchpad gesture we’re adding is the two-finger pinch gesture. With these gestures, we can control the zoom levels while using various applications in the system.

First, let’s add the two-finger pinch-in gesture, which we can use to implement zoom-out functionality:

<gesture type="PINCH" fingers="2" direction="IN">
  <action type="RUN_COMMAND">
    <repeat>true</repeat>
    <command>xdotool key ctrl+minus</command>
  </action>
</gesture>

Similarly, we add the two-finger pinch-out gesture, which we can use to implement zoom-in functionality:

<gesture type="PINCH" fingers="2" direction="OUT">
  <action type="RUN_COMMAND">
    <repeat>true</repeat>
    <command>xdotool key ctrl+plus</command>
  </action>
</gesture>

Now, we save and close the configuration file. Furthermore, we terminate the Touchegg tool using the pkill command:

$ pkill touchegg

Finally, we open the Touchegg tool using the touchegg command, and it should recognize the touchpad gestures we’ve set.

3. Using System Settings

The GNOME desktop environment in Linux facilitates an option to set touchpad gestures directly from the System Settings.

To set touchpad gestures, first, we open Settings by searching it from the Start menu:

Interface of Settings

Moreover, to configure various settings related to touchpad, we go to the Mouse & Touchpad section:

Mouse and Touchpad section interface

Thus, we can set three touchpad gestures: tap to click, two-finger scrolling, and edge scrolling. Enabling the tap-to-click gesture allows tapping from the touchpad. Additionally, the two-finger scrolling option allows us to scroll vertically or horizontally from the touchpad. Finally, enabling the edge scrolling option allows us to swipe along the edges of the touchpad.

4. Conclusion

In this article, we explored two tools to set and manage touchpad gestures in Linux.

The Touchegg tool supports a diverse range of gestures. Additionally, we can customize the action for the gestures. On the other hand, the System Setting tool is a good option for new Linux users with less technical experience. It only supports three touchpad gestures. Additionally, with the help of an easy-to-use GUI, we can enable or disable the gestures based on requirements.