This utility reads libinput gestures from your touchpad and maps them to
gestures you configure in a configuration file
~/.config/libinput-gestures.conf
. Each gesture can be configured to
activate a shell command which is typically an
xdotool command to
action desktop/window/application keyboard combinations and commands.
See the examples in the provided libinput-gestures.conf
file. My
motivation for creating this is to use triple swipe up/down to switch
GNOME workspaces, and triple swipe left/right to go backwards/forwards
in my browser, as per the default configuration.
This small and simple utility is only intended to be used temporarily until GNOME and other DE's action libinput gestures natively. It parses the output of the libinput-list-devices and libinput-debug-events utilties so is a little fragile to any version changes in their output format.
This utility is developed and tested on Arch linux with the GNOME 3 DE on Xorg. I am not sure how well this will work on other distros and other DE's etc.
You need libinput release 1.0 or later. Install prerequisites:
sudo pacman -S xdotool
IMPORTANT: You must be a member of the input group to have permission to read the touchpad device:
sudo gpasswd -a $USER input # Then log out and back in to assign this group
Then install this software:
git clone http://github.com/bulletmark/libinput-gestures
cd libinput-gestures
make install # Do this as your normal user, NOT as sudo/root.
Configure gestures in ~/.config/libinput-gestures.conf
or use the
examples already configured. The available gestures are:
- swipe up (e.g. map to GNOME SHELL move to prev workspace)
- swipe down (e.g map to GNOME SHELL move to next workspace)
- swipe left (e.g. map to GNOME/Browser go back)
- swipe right (e.g. map to GNOME/Browser go forward)
- pinch in (e.g. map to GNOME SHELL open/close overview)
- pinch out (e.g. map to GNOME SHELL open/close overview)
You can choose to specify a specific finger count, typically 3 or 4 fingers. 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. Gestures specified with finger count have priority over the same gesture specified without any finger count.
Of course, 2 finger swipes and taps are already interpreted by GNOME or your DE and apps for scrolling etc.
IMPORTANT: Test the program. Check for reported errors, missing packages, etc:
# cd to source dir, as above
make stop
# Test to print out commands that would be executed:
./libinput-gestures -d
(<ctrl-c> to stop)
# And/or test to print out commands as they are executed:
./libinput-gestures -v
(<ctrl-c> to stop)
Confirm that the correct commands are reported for your 3 finger swipe left/right/up/down gestures, and your 2 or 3 finger pinch in/out gestures. Some touchpads can also support 4 finger gestures.
Search for, and then start, the libinput-gestures app in your DE. It should also start automatically at log in and run in the background. Or you can start it immediately in the background with:
make start
You can stop the app with:
make stop
Type the following anytime to reload your configuration file:
# cd to source dir, as above
make restart
# cd to source dir, as above
git pull
make restart
# cd to source dir, as above
make uninstall
Copyright (C) 2015 Mark Blakeney. This program is distributed under the terms of the GNU General Public License. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at http://www.gnu.org/licenses/ for more details.