Skip to content

Instantly share code, notes, and snippets.

@SkyBehind
Created September 6, 2018 19:06
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save SkyBehind/d664448838d065428eded7eb6d562d4b to your computer and use it in GitHub Desktop.
Save SkyBehind/d664448838d065428eded7eb6d562d4b to your computer and use it in GitHub Desktop.
My libinput config for multi-touch gestures (using Linux on Mac). I use 3-finger side swipe for forward and back, 3-finger up/down for showing all windows, and 4-finger up/down to switch desktops.
# Configuration file for libinput-gestures.
#
# 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:
#
# action motion [finger_count] command
#
# where action and motion is either:
# swipe up
# swipe down
# swipe left
# swipe right
# pinch in
# pinch out
#
# 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 xdotool, or wmctrl. See "man xdotool" for
# the many things you can action with that tool. Note that unfortunately
# xdotool does not work with native Wayland clients.
#
# Note the default is an "internal" command that uses wmctrl to switch
# workspaces and, unlike xdotool, works on both Xorg and Wayland (via
# XWayland). It also can be configured for vertical and horizontal
# switching over tabular workspaces, as per the example below. You can
# also add "-w" to the internal command to allow wrapping workspaces.
# Move to next workspace (works for GNOME/KDE/etc on Wayland and Xorg)
gesture swipe up 3 xdotool key ctrl+F9
gesture swipe up 4 _internal ws_up
# gesture swipe up xdotool key super+Page_Down
# Move to prev workspace (works for GNOME/KDE/etc on Wayland and Xorg)
gesture swipe down 3 xdotool key ctrl+F9
gesture swipe down 4 _internal ws_down
# gesture swipe down xdotool key super+Page_Up
# Browser go forward (works only for Xorg, and Xwayland clients)
gesture swipe right 3 xdotool key alt+Right
# Browser go back (works only for Xorg, and Xwayland clients)
gesture swipe left 3 xdotool key alt+Left
# KDE: Show desktop
#gesture swipe up 4 xdotool key ctrl+F12
# KDE: Show desktop
#gesture swipe down 4 xdotool key ctrl+F12
# KDE: Zoom In
# gesture pinch in 4 xdotool key ctrl+minus
# KDE: Zoom Out
# gesture pinch out 4 xdotool key ctrl+plus
# NOTE: If you don't use "natural" scrolling direction for your touchpad
# then you may want to swap the above default left/right and up/down
# configurations.
# Optional extended swipe gestures, e.g. for browser tab navigation:
#
# Jump to next open browser tab
# gesture swipe right_up xdotool key control+Tab
#
# Jump to previous open browser tab
# gesture swipe left_up xdotool key control+shift+Tab
#
# Close current browser tab
# gesture swipe left_down xdotool key control+w
#
# Reopen and jump to last closed browser tab
# gesture swipe right_down xdotool key control+shift+t
# Example of 8 static workspaces, e.g. using KDE virtual-desktops,
# arranged in 2 rows of 4 across using swipe up/down/left/right to
# navigate in fixed planes. Must match how you have configured your
# virtual desktops.
# gesture swipe up _internal --col=2 ws_up
# gesture swipe down _internal --col=2 ws_down
# gesture swipe left _internal --row=4 ws_up
# gesture swipe right _internal --row=4 ws_down
# Example virtual desktop switching for Ubuntu Unity/Compiz. The
# _internal command does not work for Compiz but you can explicitly
# configure the swipe commands to work for a Compiz virtual 2
# dimensional desktop as follows:
# 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+Rightlin
# GNOME SHELL open/close overview (works for GNOME on Wayland and Xorg)
# gesture swipe up 3 dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'Main.overview.toggle();'
# gesture swipe down 3 dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'Main.overview.toggle();'
# Optional extended pinch gestures:
# gesture pinch clockwise <whatever command>
# gesture pinch anticlockwise <whatever command>
# 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, use the corresponding full path link under
# /dev/input/by-path/*.
#
# You can choose to use ALL touchpad devices by setting the device name
# to "all". This reduces performance slightly so only set this if you
# need to.
#
device all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment