I added in touch gestures on an Elementary OS Loki install. It’s not perfect or as responsive as a Mac’s touch, but it’s good enough.
Note: I’m no longer using Elementary OS, as I’ve switched over to Ubuntu 17.10. There’s an extension for Gnome shell extended gestures that provides similar gestures to this guide.
Adding Gestures #
For this part we’re going to be handling touch gestures. We’ll start by downloading and installing libinput gestures. The library allows for pinch in and out, but I’m only using it for swipe based gestures.
# Add yourself to the input group
sudo gpasswd -a $USER input
# Install dependencies
sudo apt-get install xdotool wmctrl libinput-tools
# Clone and install
git clone http://github.com/bulletmark/libinput-gestures
sudo ./libinput-gestures-setup install
Create a custom configuration file #
We’ll create a custom configuration that
libinput-gestures will read by default.
Insert into your config file something similar to what’s below. Any number in the config correlates to the amount of fingers it takes to trigger that gesture. Mine looks like:
gesture swipe up 3 xdotool key super+Up
gesture swipe down 3 xdotool key super+Down
gesture swipe left 4 xdotool key super+Right
gesture swipe right 4 xdotool key super+Left
gesture swipe left 3 xdotool key alt+Right
gesture swipe right 3 xdotool key alt+Left
Go ahead and restart to see it take effect. You should now have 3 and 4 finger swipe gestures enabled.
Better Tap to Click #
I don’t like the default click to tap (located in System Settings > Mouse & Touchpad ), it ends up being too sensitive on my computer and I end up dragging windows all the time by accident.
I end up enabling Tap to Click but disabling the dragging effect with
xinput. It ends up being looking something like:
# Get your device names
xinput list --name-only
# Setup Apple Magic trackpad
xinput set-prop "Apple Trackpad" "libinput Tapping Enabled" 1
xinput set-prop "Apple Trackpad" "libinput Tapping Drag Enabled" 0
# Setup laptop trackpad
xinput set-prop "Laptop Touchpad" "libinput Tapping Enabled" 1
xinput set-prop "Laptop Touchpad" "libinput Tapping Drag Enabled" 0
*Note: This only is retained for the current session, you’ll need to create an application startup script (System Settings -> Apps -> Launch at Startup
) to retain this when logging/restarting*
I find this a much better experience, and I’m quite enjoying my recent move from Mac to Linux, especially now that I have similar shortcuts and touch gestures.