Gestures

I’ve been pretty unhappy with Firefox for a while — I think it’s just annoying and crashy. I’ve tried various other browsers, I used Epiphany and Safari for a while, but today I thought I’d try something new so I installed Firefox 3 Beta to see if it really was as good as Mozilla claim. And the news is good: it’s probably fair to describe it as the best browser ever. I like the new UI, I like the combined URL/search box, I really like the new dialog-less would you like to save your password UI, and so far it hasn’t crashed on me. Yay!

And the best thing I discovered today isn’t even the new firefox — it was the FireGestures extension, which I think has been around for a while. This extension is seriously cool!

FireGestures works very straightforwardly. When you hold the right mouse button down it keeps track of which direction you move the mouse. For instance, when you draw a counter-clockwise circle it records that you moved the mouse left down right up left, or LDRUL, and when you release the mouse button it executes the associated action. In the case of LDRUL it opens the FireGestures configuration dialog. There is a bunch of predefined gestures: L goes back, R goes forward, LR opens a new tab and DR closes the current tab. I like the DR gesture because it draws an upper case L, and l is the first letter in the Danish word for “close”.

The best thing about FireGestures though is that you can add your own gestures with a custom sequence of mouse moves and an action implemented in JavaScript. The code for custom gestures have access to information about the page, for instance the DOM node on which the gesture started and the text currently selected.

I’ve used this to add a custom gesture that triggers when you draw a W (or DRUDRU) and searches wikipedia for the currently selected text, or if no text is selected goes to the wikipedia front page:

var text = FireGestures.getSelectedText();
if (text) {
var encoded = encodeURI(text);
var root = "http://en.wikipedia.org/wiki/Special:Search?search=";
gBrowser.loadURI(root + encoded);
} else {
gBrowser.loadURI("http://www.wikipedia.org");
}

Pretty easy — just a few straightforward lines — but really useful. Another gesture I’ve added shows the bug tracker page for the selected bug number in a new tab when I draw a ‘b’ (or DURDL):

var text = FireGestures.getSelectedText();
if (text) {
var root = "https://bugzilla.mozilla.org/show_bug.cgi?id=";
var encoded = encodeURI(text);
gBrowser.selectedTab = gBrowser.loadOneTab(root + encoded);
}

(I’ve replaced the URL to our internal bug tracking system with firefox’).

This is a great extension — simple, straightforward and extensible.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>