A swipe can switch workspaces by triggering the same shortcut you would press on the keyboard. This note records two setups from 2020: libinput-gestures for a touchpad, and an older Touchégg configuration for a touchscreen.
The original Ubuntu/Linux Mint release and tool versions were not recorded. The examples below explain the setup, but they still need testing on a specified desktop and release.
Check your desktop’s own gestures first
GNOME documents built-in touchpad and touchscreen gestures. Try the actions you need before adding another gesture service.
The xdotool workspace shortcuts below target X11. They do not control a native GNOME Wayland desktop. Touchégg’s upstream FAQ also limits it to X11. A gesture configuration that worked on an older Ubuntu session may therefore be the wrong tool for your current session.
A touchpad swipe becomes a keyboard shortcut
In this setup, libinput reports a gesture, libinput-gestures matches a configuration line, and xdotool sends the keys. If the keyboard shortcut doesn’t switch workspaces by itself, mapping a swipe to it won’t help.
Try Ctrl+Alt+Left and Ctrl+Alt+Right in the intended X11 session first. Check your desktop’s keyboard settings if they do something else.
Give the gesture reader access to the device
The original setup added the desktop user to the input group:
sudo gpasswd -a "$USER" input
This grants access to input devices, including more than the touchpad. Read the project’s permissions warning before using it. Group membership needs a new session; the upstream instructions request a reboot. Save your work before restarting.
Install the tools used by the old setup
The original package command was:
sudo apt-get install xdotool wmctrl libinput-tools
The clone step also needs Git. These are the historical source-install commands; cloning the default branch today will not recover the version used in 2020. Follow the project’s installation notes for a new setup and inspect the installer before running it with sudo.
cd ~
git clone https://github.com/bulletmark/libinput-gestures .libinput-gestures
cd ~/.libinput-gestures
sudo ./libinput-gestures-setup install
Keep the checkout if you want to inspect or update that installation. The old notes deleted it immediately after installation; that cleanup is unnecessary.
Put your shortcut mappings in a user configuration
The original article edited /etc/libinput-gestures.conf. The project also supports a personal copy at ~/.config/libinput-gestures.conf, which avoids changing defaults for other users:
mkdir -p ~/.config
cp /etc/libinput-gestures.conf ~/.config/libinput-gestures.conf
vim ~/.config/libinput-gestures.conf
Skip the copy if you already have a personal configuration, and edit that file instead. Keep a backup before replacing any existing mappings.
In the copy, comment out conflicting gesture lines and add the original mappings:
gesture swipe up xdotool key ctrl+alt+Up
gesture swipe down xdotool key ctrl+alt+Down
gesture swipe left xdotool key ctrl+alt+Left
gesture swipe right xdotool key ctrl+alt+Right
These shortcuts assume the desktop has workspaces in the requested direction. Two-finger scrolling is a separate action; libinput describes swipe gestures as three or more fingers moving together.
Start the service in your desktop session, after refreshing group membership:
libinput-gestures-setup start
Once the mappings behave as intended, enable startup at login:
libinput-gestures-setup autostart
After editing a running setup, use libinput-gestures-setup restart to reload it. If a swipe does nothing, the project’s debugging instructions separate missing gesture events from commands that fail to run.
The touchscreen example uses the old Touchégg format
This March 2020 configuration predates the Touchégg 2.0 rewrite, released that September. Its DRAG actions and inline action values are historical syntax. Do not paste this XML into a current configuration and expect it to work; use the current configuration reference for the installed version.
The old package installation command, with the required administrator privilege made explicit, was:
sudo apt install touchegg
A distribution package today may contain a different version from the one behind these notes. For the historical setup, the user configuration lived at ~/.config/touchegg/touchegg.conf:
vim ~/.config/touchegg/touchegg.conf
In this example, a two-finger tap sends a right click and a two-finger drag scrolls. Three-finger drags send the workspace shortcuts. Its five-finger tap closed a window, so leave it disabled while trying the other mappings.
<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="5" direction="">
<action type="CLOSE_WINDOW"></action>
</gesture>
<gesture type="DRAG" fingers="2" direction="ALL">
<action type="SCROLL">SPEED=7:INVERTED=true</action>
</gesture>
<gesture type="DRAG" fingers="3" direction="UP">
<action type="SEND_KEYS">Control+Alt+Up</action>
</gesture>
<gesture type="DRAG" fingers="3" direction="DOWN">
<action type="SEND_KEYS">Control+Alt+Down</action>
</gesture>
<gesture type="DRAG" fingers="3" direction="LEFT">
<action type="SEND_KEYS">Control+Alt+Left</action>
</gesture>
<gesture type="DRAG" fingers="3" direction="RIGHT">
<action type="SEND_KEYS">Control+Alt+Right</action>
</gesture>
</application>
</touchégg>
Start any new setup with one action, such as switching to the next workspace. Confirm the shortcut works, then confirm the gesture triggers it. If the swipe fails, you can then check gesture recognition without also wondering whether the shortcut is wrong.
