How to Configure a Touchscreen on Linux
Ah the touchscreen ─ that piece of hardware that promises to finally strip humanity of an interface very much long in the tooth. I’m talking about the mouse. It’s that piece of technology that is being threatened with extinction, thanks to the touchscreen. And with good reason. Once you’ve used the touchscreen, you fully understand that they are, in fact, a much-needed breath of fresh air.
But in Linux-land, all isn’t exactly rosy. Once you get your hands on a supported device (such as the fantastic System76 Sable Touch running Ubuntu 14.10), you’ll find that not everything works as you’d expect. Sure there are some handy three and four finger multi-touch gestures that work out of the box, but the go-to gestures (such as right mouse click and Firefox scrolling) simply don’t work.
The good news, getting those very necessary gestures to work isn’t all that challenging. It does, however, require the installation of an app and a Firefox extension. The bad news is that not all distributions respond the same way to these workarounds. Ultimately, this falls into the hands of the Linux community to resolve, as touchscreens aren’t going away (and, in fact, will continue to rise in popularity). With that said, let’s take a look at what you can do to get that shiny new touchscreen device working in a way that actually makes sense.
What you will need
First we’re going to address the browser ─ since that is one of the most-used tools of the desktop trade. There’s a bit more bad news on that front ─ you’re going to have to scrap Google Chrome. Why? Because, at least as of this writing, Google Chrome and Linux touchscreens do not play well together. With that said, we’re going to focus our efforts on Firefox and a simple extension.
Second, you will need to install and use a handy app called Touchegg. This app will serve as a means to configure specific events for touchscreen interaction.
With that said, let’s begin.
Firefox
Out of the box, Firefox doesn’t much care for touchscreens. However, there is an extension you can install that will overcome that issue. The extension is called Grab and Drag. This extension will enable grab and drag scrolling as well as flick scrolling and momentum scrolling.
To install this extension click Tools > Add-ons and then click Get Add-ons. In the search bar of the new tab, enter “grab and drag.” When the results appear (Figure 1), click the Install button associated with the Grab and Drag extension.
You will be prompted to restart Firefox. Do this and then, when it reopens go back into the Add-ons window, tap Extensions, select Grab and Drag, and then tap Preferences. In the Preferences screen, you can ignore the Momentum tab (as this feature doesn’t work with touchscreens). You will, most likely, want to open the More Options tab and play with the Drag Multiplier setting (Figure 2). By default, the scrolling is rather slow. I’ve found a Drag Multiplier of 1.6 to be ideal for using touchscreens and Firefox.
Now that you have Firefox enabled, let’s install an app that (in some instances) will allow you to control nearly every multi-touch gesture on Linux.
Touchegg
I’ll demonstrate how to install this app on Ubuntu 14.10. I will also add a GUI tool that allows easier control over the configuration of gestures. The GUI tool, touchegg-gce, does have a number of dependencies that must be first installed.
Before we install the GUI, let’s install the base tool. Touchegg can be found in the standard repositories, so a single command will install:
sudo apt-get install touchegg
Once that installation completes, let’s install the dependencies for the GUI tool. The command for this is:
sudo apt-get install build-essential libqt4-dev libx11-6
After the dependencies are installed, download the Touchegg-gce file and place it in a directory that gives you write access (such as ~/). Here are the steps to install this app:
- Change to the directory holding the .zip file.
- Issue the command unzip Touchegg-gce-master.zip to extract the file.
- Change into the Touchegg-gce-master folder.
- Issue the command qmake
- Issue the command make
- Copy the touchegg-gce file to /usr/bin
That’s it. You can now issue the command touchegg-gce from any directory and the app will run. When the app starts, you must first choose your language (this happens every time you run the app). From the app main window (Figure 3), tap the Load button to load your Touchegg configuration file (the default should be ~/.config/touchegg/).
At this point, you can either modify an existing gesture or add a new gesture. What you need to know about this process is the configuration options available. With each entry, there are four options:
- Fingers: How many fingers make up the entry
- Gesture: What is the actual gesture (tap, drag, pinch, rotate, Tap & Hold, Double Tap)
- Direction: The direction of the gesture (All, Up, Down, Left, Right)
- Action: What is the action associated with the gesture (i.e. Mouse Click, Scroll, Minimize, Maximize, Close, etc).
Tap (or click) the Add button to create a new gesture. For the purpose of example, we’ll create a two finger drag for scrolling up. We’ll create this gesture under the All Group (which means it will apply to all applications ─ more on this in a bit). From the popup window (Figure 4), configure the following:
When you’ve configured this, tap OK and the gesture is ready to try out.
Let’s say, however, you want to associate a specific gesture with a specific application (or group of applications). For that you must create a new Group. To do this, tap the Add button under the groups (on the left side of the window). In the popup (Figure 5), you have to configure three options:
- Applications: The applications this gesture will use
- Add to: Select to create a new group
- Take gestures from: You can import gestures from another group to serve as a template.
Once you’ve created the new group, you can create new gestures that will work only for that group.
After you’ve completed the process of creating gestures and groups, make sure to tap (or click) the Save button. If you do not do this final step, your configurations will be lost when you close the app. When you save the configuration, Touchegg will be restarted and your new gestures should work.
Even with the help of apps like Drag and Grab and Touchegg, Linux and the touchscreen have a long way to go. Not every gesture will work on every device and, in some cases, you might still find yourself grabbing a mouse more often than not. Hopefully, over the next year, we’ll see major improvement on this front ─ otherwise Linux will struggle as more and more touchscreen devices are adopted.