WMGestures

Multi-Touch Touchpad Gestures for Window Managers in Linux

Posted by

Ever since I switched my Linux install to a tiling Window Manager I’ve been trying to find ways to recreate functionality I was taking for granted under normal Desktop Environments such as GNOME. I managed to solve one of my major gripes to get Caffeine like functionality in a WM by creating my own Polybar module.

Thankfully the way to get multi-touch touchpad gestures in a tiling Window Manager is much, much easier.

All the necessary software is readily available on GitHub and is very simple to install and configure!

i3-wm, BSPWM and most of the other tiling WMs don’t support multi-touch gestures by default, so an external tool which can detect them and then fire off commands is needed. That tool is called libinput-gestures.

Users of Arch based distros can install the necessary packages using the AUR whereas for other Linux distros the libinput-gestures package must be build from source through Github.

Dependencies

There are some dependencies for the libinput-package to install and work correctly so make sure those are installed prior to proceeding:

  1. Python 3.6 (should already be installed)
  2. libinput (Arch based systems already have the package as dependency for Xorg / Wayland)
  3. wmctrl
  4. xdotool

The above packages should be available in your Linux distro’s repositories, if not already installed on your system.

# Arch based distros:
sudo pacman -S wmctrl xdotool

# Debian based systems, i.e. Ubuntu:
sudo apt-get install wmctrl xdotool libinput-tools

# Fedora:
sudo dnf install wmctrl xdotool libinput

You also must be a member of the input group to have permission to read the touchpad device:

sudo gpasswd -a $USER input

It is also very important to reboot your machine after installing the dependencies above and running the command to become a member of the input group.

Installation

Arch based systems can use the AUR to install the package using the preferred AUR package manager:

sudo yay -S libinput-gestures
or
sudo paru -S libinput-gestures

For other Linux distros the package can be build from source (make sure git is installed on your system):

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

Configuration

The default configuration of the libinput package should be sufficient for most users. However if you want to edit this configuration you can refer to the libinput documentation.

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.

For Window Managers I would strongly recommend adding the swipe workspace three-finger gesture to navigate between full screen applications.

To get this functionality simply add these two lines or a variation of them to the ~/.config/libinput-gestures.conf file:

gesture swipe up 3 i3-msg workspace prev
gesture swipe down 3 i3-msg workspace next

You then need to reboot your system for the changes to take effect.

To test your configuration and make sure everything is working correctly you need to start the libinput daemon (sudo privileges may be required):

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

Use a three finger swipe gesture to make sure you can switch between workspaces, and you are done!

Note: For i3-wm the daemon may not automatically start on system boot/reboot so you need to add the following in your i3 config file:

exec --no-startup-id libinput-gestures-setup start

Uninstall

If you want to uninstall the libinput-gestures package for any reason you just need to run the following commands:

libinput-gestures-setup stop autostop
sudo libinput-gestures-setup uninstall

Troubleshooting/Additional Config

For any problems you need to troubleshoot or additional configuration you want to perform you can refer to the project’s GitHub page which has detailed instructions for anything you may need.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments