gestures

Contents
Installation Usage

Source at the Bit Powder GitLab

Gesture support on Linux does not work out of the box. It needs some userspace daemon to handle the gestures, like 4 finger swipe to switch to a different desktop/workspace, or 3 finger swipe to go back/forward in browsers.

There used to be the excellent gebaar-libinput for this, but it is unmaintained and it fails to compile on newer versions of Linux.

This package gestures is a simpler version, that is easy to compile and modify. It uses libinput to track the input and executes a shell script based on the gestures. It executes the script $HOME/.config/gestures/three-to-left (with either three or four, and either left/`right`/`top`/`bottom`). This avoids a config script, and parsing it. See below for examples.

Installation

For Debian and Raspbian, add the bitpowder repository. See the instructions on that repository page.

To build the project from the source, you need cmake and a C++ compiler:

cmake .
cmake --build .
cmake --install .

Usage

In your i3/sway config add:
exec --no-startup-id gestures

$HOME/.config/gestures/three-to-right

Swipe to right to go back in browsers. Set execute permissions on this file.

#!/bin/sh
# Space thing is needed for Chromium based browsers in wayland
if [ -n "$WAYLAND_DISPLAY" ]; then
  wtype -P space -s 1 -p space -s 1 -M alt -P left -s 10 -m alt -p left
elif [ -n "$DISPLAY" ]; then
  xdotool key Alt+Left
fi

$HOME/.config/gestures/three-to-left

Swipe to left to go forward in browsers. Set execute permissions on this file.

#!/bin/sh
# Space thing is needed for Chromium based browsers in wayland
if [ -n "$WAYLAND_DISPLAY" ]; then
  wtype -P space -s 1 -p space -s 1 -M alt -P right -s 10 -m alt -p right
elif [ -n "$DISPLAY" ]; then
  xdotool key Alt+Right
fi

$HOME/.config/gestures/four-to-left

Swipe to right to go in i3/sway to the previous workspace. Set execute permissions on this file.

#!/bin/sh
i3-msg workspace next

$HOME/.config/gestures/four-to-right

Swipe to right to go in i3/sway to the previous workspace. Set execute permissions on this file.

#!/bin/sh
i3-msg workspace prev