Make your linux touchpad have gesture like Windows or Mac. That’s easy bro!

Afiv Dicky Efendy
5 min readNov 19, 2020
touchpad gesture

Hi here again, if you see this article then you are in luck. because people who are starting to switch from Windows to Linux for learning needs or are just curious will be a little uncomfortable with the absence of gestures on the touchpad like Windows.

It cannot be denied that the touchpad gesture will greatly simplify and speed up your activities. Especially if you are comfortable with the Windows or Mac operating system

But don’t worry because in this tutorial I will share how to make a our linux touchpad can use gestures like on windows or mac.

Installation

Firstly, you must be a member of the input group to have permission to read the touchpad device:

sudo gpasswd -a $USER input

After executing the above command, reboot your system.

Most/many users will require to install the following although neither are actual dependencies because some custom configurations will not require them. If you are unsure initially, install both of them.

# E.g. On Arch:
sudo pacman -S wmctrl xdotool

# E.g. On Debian based systems, e.g. Ubuntu:
sudo apt-get install wmctrl xdotool

# E.g. On Fedora:
sudo dnf install wmctrl xdotool

Debian and Ubuntu users may also need to install libinput-tools if that package exists in your release:

sudo apt-get install libinput-tools

Install this software:

git clone https://github.com/bulletmark/libinput-gestures.git
cd libinput-gestures
sudo ./libinput-gestures-setup install

Configuration

It is helpful to start by reading the documentation about what libinput calls gestures. Many users will be happy with the default configuration in which case you can just type the following and you are ready to go:

libinput-gestures-setup autostart
libinput-gestures-setup start

Otherwise, if you want to create your own custom gestures etc, keep reading ..

The default gestures are in /etc/libinput-gestures.conf. If you want to create your own custom gestures then copy that file to ~/.config/libinput-gestures.conf and edit it. There are many examples and options described in that file.

Or you can also match the configuration file with mine. copy the commands below and save it as ~/.config/libinput-gestures.conf

# Configuration file for libinput-gestures.
# Mark Blakeney, Sep 2015
#
# The default configuration file exists at /etc/libinput-gestures.conf
# but a user can create a personal custom configuration file at
# ~/.config/libinput-gestures.conf.
#
# Lines starting with '#' and blank lines are ignored. Currently
# "gesture" and "device" configuration keywords are supported as
# described below. The keyword can optionally be appended with a ":" (to
# maintain compatibility with original format configuration files).
#
# Each gesture line has 3 [or 4] arguments separated by whitespace:
#
# action motion [finger_count] command
#
# where action and motion is either:
# swipe up
# swipe down
# swipe left
# swipe right
# swipe left_up
# swipe left_down
# swipe right_up
# swipe right_down
# pinch in
# pinch out
# pinch clockwise
# pinch anticlockwise
#
# command is the remainder of the line and is any valid shell command +
# arguments.
#
# finger_count is a single numeric digit and is optional (and is
# typically 3 or 4). If specified then the command is executed when
# exactly that number of fingers is used in the gesture. If not
# specified then the command is executed when that gesture is executed
# with any number of fingers. Gesture lines specified with finger_count
# have priority over the same gesture specified without any
# finger_count.
#
# Typically command will be _internal, or xdotool. See "man xdotool" for
# the many things you can action with that tool. Note that unfortunately
# xdotool does not work with native Wayland clients.
###############################################################################
# SWIPE GESTURES:
###############################################################################
# Move to next workspace (works for GNOME/KDE/etc on Wayland and Xorg)
gesture swipe up xdotool key ctrl+super+Up
# Move to prev workspace (works for GNOME/KDE/etc on Wayland and Xorg)
gesture swipe down xdotool key ctrl+super+Down
# Browser go forward (works only for Xorg, and Xwayland clients)
gesture swipe right xdotool key alt+Right
# Browser go back (works only for Xorg, and Xwayland clients)
gesture swipe left xdotool key alt+Left
###############################################################################
# PINCH GESTURES:
###############################################################################
# GNOME SHELL open/close overview (works for GNOME on Xorg only)
gesture pinch in xdotool key super+tab
gesture pinch out xdotool key alt+F1
###############################################################################
# This application normally determines your touchpad device
# automatically. Some users may have multiple touchpads but by default
# we use only the first one found. However, you can choose to specify
# the explicit device name to use. Run "libinput list-devices" to work
# out the name of your device (from the "Device:" field). Then add a
# device line specifying that name, e.g:
#
# device DLL0665:01 06CB:76AD Touchpad
#
# If the device name starts with a '/' then it is instead considered as
# the explicit device path although since device paths can change
# through reboots this is best to be a symlink. E.g. instead of specifying
# /dev/input/event12, you should use the corresponding full path link
# under /dev/input/by-path/ or /dev/input/by-id/.
#
# You can choose to use ALL touchpad devices by setting the device name
# to "all". E.g. Do this if you have multiple touchpads which you want
# to use in parallel. This reduces performance slightly so only set this
# if you have to.
#
# device all
###############################################################################
# You can set a minimum travel distance threshold before swipe gestures
# are actioned using the swipe_threshold configuration command.
# Specify this value in dots. The default is 0.
# E.g. set it to 100 dots with "swipe_threshold 100".
# swipe_threshold 0
###############################################################################
# You can set a timeout on gestures from start to end. The default is
# the value commented below. It can be any value in float secs >= 0.
# 0 = no timeout. E.g. set it to 2 secs with "timeout 2".
# timeout 1.5

After that save and reboot. Then you can start enjoying it.

Thanks for reading and don’t forget to clap this articel 👌

You don’t have to do the commands below if it’s running smoothly.

Starting and Stopping

Start the application immediately in the background using the command line utility:

libinput-gestures-setup start

You can stop the background app with:

libinput-gestures-setup stop

You can enable the app to start automatically in the background when you log in (on an XDG compliant DE such as GNOME and KDE) with:

libinput-gestures-setup autostart

You can disable the app from starting automatically with:

libinput-gestures-setup autostop

You can restart the app or reload the configuration file with:

libinput-gestures-setup restart

You can check the status of the app with:

libinput-gestures-setup status

Thanks for reading and don’t forget to clap this article 👌

--

--

Afiv Dicky Efendy

Linux enthusiast who wants to share his knowledge through writing on the medium