This is going to be a surprise to a number of people out there, but not only does the KDE Plasma desktop environment have gestures built in, but it has had them since the 3.2 (roughly) release. Gestures in KDE Plasma aren't just tied to the browser (I covered Firefox mouse gestues here), but pretty much anything in the desktop environment. With a few flicks of the mouse, you can make magic happen across your entire desktop experience. It all sounds new and exciting, but the functionality has been there for years and few people seem to know about this excellent feature. Let me tell you how it works.
To see existing mouse gestures that you can use, or create your own, fire up the KDE System Settings program. To do so, click the Application Launcher (the big K in the lower left, and select it from there; it's usually in the Favorites menu, or you can find it under the Computer section (or you can just type "system settings" in the search field of the launcher). When the System Settings window appears, click "Shortcuts and Gestures" which you'll find under the "Common Appearance and Behavior" section (see Figure 1).
Figure 1 : Mouse gesture configuration is found in KDE's System Settings.
First, make sure you enable gestures by clicking that text box in the top right section, then click apply (see close-up in Figure 2).
Figure 2 : Make sure you have enabled gestures as well. On a two-button wheel mouse, button 2 is the clickable wheel.
The Shortcuts and Gestures window has a sidebar to the left that offers three sets of shortcuts. These are custom shortcuts, standard application specific keyboard shortcuts, and global keyboard shortcuts. It doesn't specifically say "gestures" here because keyboard shortcuts are one type of shortcut while mouse gestures are another. Since the selection defaults to custom, and this is where we want to be, look at the middle section where you'll see "Input Actions settings" for a handful of applications, each label representing a group of applications with one of more shortcut (or gesture) defined below. To see the various predefined gestures, click the small arrow to the left of the label (see Figure 3).
Figure 3 : Every pre-defined gesture can be viewed, or changed.
Click on any action (e.g. Home under Konqueror Gestures) and a three-tabbed pane will appear to the left of the window. The tabs are labeled Comment, Trigger, and Action. The comment is exactly what it sounds like, a description of the shortcut with as little or as much information as you want. The trigger, in this case, is a mouse gesture. Using Home as our example, the gesture trigger is a stylized "h" that starts at the light green end of the line and ends at the dark blue. Click the Action tab and you'll see that it actually translates into the Konqueror "Ctrl+Home" keyboard shortcut which loads the home page.
With the latest Plasma in Kubuntu, Konqueror has been replaced with rekonq as the default browser. To use the pre-defined gestures, I installed Konqueror with "apt-get install konqueror".
So now that you see how this works, let's create our own gestures. Click on the edit button at the bottom of the middle pane of the shortcuts window. A drop down menu will appear. What we are going to do is create a group of our own gestures, much like the set for Konqueror. Click on New Group (see Figure 4). A folder will appear with a default name of "New Group" highlighted; just type the name you want to use (e.g. "My Gestures") and press Enter. A check mark will be added next to the group. Click on Apply (lower right) to save the changes.
Figure 4 : From the edit menu, select New Group to create a category of gestures.
The group folder gets created in whatever position you put it. If you don't like the position, you can drag it up and down the list, even inside other folders. Now, with the folder selected, click on the Edit menu once more. This time, click New, "Mouse Gesture Action", and select "Command/URL" from the list (see Figure 5). Your other options are D-Bus Command, and "Send Keyboard Input".
Figure 5 : There's more than one type of gesture action, allowing for almost anything KDE can do.
In this example, I'm going to create a command action. With a stylized "me", I'm going to fire up Konqueror and have it open up a page on the MarcelGagne.com Website. In the comment tab, I wrote "Start Konqueror on my site", then clicked on the Trigger tab where I clicked "Edit". When you do this, a small window appears that has the feel of a tablet waiting for you to draw something, which I suppose is the point (see Figure 6). There is an important thing to notice here though. Despite the fact that you are using the middle button to do your gestures on the live desktop, here in the drawing space, you will be pressing and holding only the left mouse button as you draw.
Figure 6 : While editing your new gesture, you are provided with a virtual tablet on which to draw.
When you're entered your mouse gesture, click OK and you'll see it in the Trigger tab view. If you don't like what you see, you can always do it again. The only thing left to do is associate a command with this gesture (see Figure 6). Click the Action tab and enter the command.
Click Apply and you are done. If you simply want KDE to fire up your default browser, you don't even need to enter the "konqueror" part of the command. As the field indicates, you can simply enter the URL and KDE will do the rest. All I have to do now is hold down the middle mouse button, scawl my 'me' and the browser pops up to my home page.
Once you start doing the gestures dance, it's hard to stop. In a similar fashion, I created commands to start a Konsole terminal, the Dolphin file manager, Firefox, Chromium, a few virtual machines running under KVM . . . you get the idea. It's all extremely cool.