January 29, 2008

Using mouse gestures across Linux

Author: Shashank Sharma

My first brush with mouse gestures on the Opera browser was an accident, but the ability to quickly move backward or forward in the browser history, open new windows, close tabs, and more without using the menus or moving the mouse toward the navigation toolbar won me over immediately. Nowadays, this feature is available in Firefox and Konqueror too, and you can even configure mouse gestures for GNOME and KDE desktop environments.

Mouse gestures, in essence, are similar to keyboard shortcuts. With mouse gestures, you can assign regular tasks to drawn mouse patterns. For example, clicking and dragging the mouse to the left can move you to the page you were previously browsing.

To use mouse gestures in Konqueror, open the Control Center and select Accessibility, then click Input Actions. From here you can configure keyboard and mouse hotkeys. There are several default keyboard shortcuts that you can browse through under Examples. Under Konqueror Gestures, uncheck the Disable check-box to the right of the window.

To view the mouse gesture associated with any task, click on the task name and then click the Gestures tab on the right of the screen. For instance, the mouse gesture for Close Tab is a Z shape, but with straight lines. For your benefit, there's also a number next to it, 78523. If you imagine the number key pad on your keyboard, you can determine that 78523 means you have to press the button, move right, move down, move right and then release the button to close the tab.

If you wish to modify a gesture, click the Edit button under the Gestures tab. Click Reset to delete the default action, then draw your custom action three times.

If you prefer the Firefox browser, you can install the Mouse Gestures extension, which offers gestures for tasks such as minimizing and maximizing windows, scrolling a page, and switching tabs. Once you've installed the extension, enable it by clicking Tools -> Add-ons -> Extensions.

Next, click the Preferences button to configure the mouse actions. I use mouse trails so I can see what mouse gesture I'm drawing. To do this, click the Visual settings tab and enable Activate mouse trails. To edit a mouse gesture, click the Edit Gestures button under the General tab. Unlike Konqueror's gestures, which are expressed as all numeric, some of Firefox's gestures are expressed as alphanumeric. The 2, 4, 6, and 8 on the number pad have been switched with D, L, R, and U respectively, for down, left, right, and up. So while switching to the next tab in Konqueror required moving the mouse in 14789 direction, the same action in Firefox is done by clicking the button and moving the mouse in UR direction.

To change any gesture, click Edit after selecting it from the Active gestures list. You can either type in the code for the new gesture in the Gesture code field, or, if you'd rather draw the new gesture, do that by clicking the Recognize button.

Other applications, such as Brightside, allow you to configure mouse actions for the desktop environments. With Brightside, you can configure screen corner actions, so that moving the mouse to a corner launches the screen saver, or mutes the volume. On KDE, you can configure two similar actions from the Control Center. For example, to configure the screen saver to launch automatically, select Screen Saver under Appearance & Themes or Desktop (depending on your distribution) and click Advanced Options. From there you can associate screen locking with the screen corners. You can also configure edge flipping such that you can switch between virtual desktops by moving the mouse pointer to the edges from Control Center -> Desktop -> Window Behavior. Click the Advance tab on the right and then click the Always enabled radio button under Active Desktop Borders.

Dekstop gestures

To get the mouse gestures functionality on your GNOME desktop, you can choose between two programs, Gestikk and wayV.

The recently released Gestikk 0.4 is more usable than the previous release. Gestikk has a small dependency list that includes Python, wxPython, and GTK+. Once you've installed all of Gestikk's dependencies, download and explode the gestikk-0.4.tar.gz file with the tar zxvf gestikk-0.4.tar.gz command.

Gestikk itself doesn't require any installation. Just browse to the gestikk-0.4 directory and run the command python -c gestikk.py to launch the Configuration dialog box. Under the Preferences tab, change the Tolerance value to the recommended 20 instead of the default 100. Next, click the Gestures tab and then click the Add button. Now you need to draw a gesture in the new window that opens to create your first mouse gesture. After you've drawn a recognizable gesture, you'd be asked to redraw to confirm. When that's done, a new window pops up where you can specify the action you wish to associate with the drawn mouse gesture. Click Command and type the application name in the text field, then click Create. Click the Apply button to save your mouse gesture. To close the configuration window click Cancel.

You can now test your mouse gesture. First, launch Gestikk with the command python gestikk.py. Now draw your mouse gesture while keeping the Ctrl key pressed down. Gestikk will launch the associated application when you correctly draw the relevant mouse gesture.

Installing wayV on the other hand is as easy as running the ./configure, make, and make install commands. wayV stores its configuration file in /usr/local/etc/wayv/wayv.conf. The file lists all recognizable mouse gestures at the top, and all actions associated with each gesutre are listed at the bottom of the file. In the pictorial representation for each gesture, the digit 1 denotes the path you need to draw. The vector field below the pictorial representation further assists in interpreting the mouse movement. For example, the vector field for mouse gesture C is W, SW, S, SE, E:

Gesture {
name = "C";
description = "C";
shape =
0, 0, 0, 1, 1, 1, 1, 0
, 0, 1, 1, 1, 0, 0, 0, 0
, 1, 1, 0, 0, 0, 0, 0, 0
, 1, 0, 0, 0, 0, 0, 0, 0
, 1, 0, 0, 0, 0, 0, 0, 0
, 1, 0, 0, 0, 0, 0, 0, 0
, 0, 1, 1, 0, 0, 0, 0, 0
, 0, 0, 0, 1, 1, 1, 1, 1
vector = W, SW, S, SE, E;
action = "Action C";

To modify the action associated with any gesture, scroll to the relevant Action line in the file and edit the process field. For instance, I changed the action associated with mouse gesture C to launch gcalctool:

Action {
name = "Action C";
process = exec "gcalctool";
match = "";

You can similarly associate actions to each mouse gesture. When you're done, save the file and launch wayV from the terminal with the command wayv. You can now draw your mouse gestures using the middle mouse button, or whatever you're using to emulate a middle button.


Whether mouse gestures work for you depends on the type of mouse user you are. If you're the kind who likes to select lines of text as you read them, then mouse gestures likely would interfere and frustrate you, since selecting even two words on a line can drop you to the previous page in the browser history. But if you're not, then you might enjoy and even benefit from using mouse gestures.


  • Desktop Software
  • Graphical Environments
  • Tools & Utilities