Introduction

A couple of conversations yesterday got me thinking about touch support for egmde. The “launcher” already supported touch to the extent that the selected app could be launched by touching the middle of the screen or changed by touching above or below. But there was no touch based way of invoking the launcher.

This was fairly simple to add: This article covers adding a “swipe from left” gesture to bring up the launcher and a “swipe to left” to dismiss it.

The egmde snap

The functionality described here is already available from the “edge” egmde snap (which also uses the current Mir “release candidate”):

snap install --edge --classic egmde

This will install egmde and a “.desktop” file that enables it as an option in the greeter.

The rest of the article describes the code needed for this and building that code.

Preparation

The code in this article needs Mir. The version in the Ubuntu 18.04 archive is adequate (and also the version in Fedora) but I recommend using the latest Mir release from the mir-team/release PPA.

Naturally, the code is likely to evolve, so you will find other branches, but this branch goes with this article.

Invoking the launcher

I added a “lambda” in main() (egmde.cpp) that looks for a swipe from the left and invokes the launcher, most of the code is ignoring “uninteresting” events. Probably the only non-obvious point is that once the gesture has started we continue to “use” events until the gesture ends (that is necessary in server input event handling to avoid clients getting incomplete gestures):