22 October 2008 - 5:20Touching Firefox

I finally upgraded from my iBook G4 to one of those new shiny aluminum MacBooks last Tuesday, so over the weekend, I got to play around with the big buttonless glass trackpad. I noticed that I often used the 4-finger gestures to show all windows or the desktop but rarely used any 3-finger ones.

I knew iPhoto supported 3-finger swipes to switch between pictures, so I figured I should file a bug so Firefox could do something similar to switch tabs. Lo and behold, there’s already a bug filed and resolved fixed since April! Three-finger navigation gestures on MacBook Pro trackpads should be recognized [bugzilla.mozilla.org]

Wait a minute.. that’s Camino! But it didn’t take long to find two related bugs: Core: widget/event-detection support for multi-touch trackpad gestures and Firefox: Implementation of Multi-Touch Gestures on Mac OS X [bugzilla.mozilla.org].

And even better is that both bugs have patches already reviewed or in the process of getting reviewed. The bugs were inactive for a few months, but Tom Dyas appeared out of nowhere (AFAICT) and started submitting patches with the help of Camino, Mac, DOM guys.

Earlier I took the Firefox patch and tweaked it slightly to conform better to sdwilsh style standards ;) and added various refactoring. And now I’ve tossed those pair of patches up on the try-server so people can touch Firefox with a new set of gestures.

A quick detour for those not familiar with the multi-touch gestures.. The most basic multi-touch gesture is the 2-finger scroll which has been around for over 3 years (my iBook had it), and it lets you scroll through pages up/down/left/right/diagonally. Recently added is the 3-finger “swipe” where you place 3 fingers on the trackpad and move them in any direction like the 2-finger scroll. A couple other iPhone-inspired gestures are the “pinch” (2 fingers moving towards/away from each other) and the “twist” (2 fingers rotating).

Note! The following gestures are totally tentative and subject to change, and I’m not sure if they’ll even make it into Firefox 3.1. (From what I quickly gathered, the gestures interface was reverse engineered from some private Apple API, so things might change at any time!) You have been warned! :P

  • Swipe Left: Go back in history [bonus! hold Cmd to open it in a tab]
  • Swipe Right: Go forwards in history
  • Swipe Up: Return to top of page
  • Swipe Down: End of page
  • Pinch Together: Zoom out
  • Pinch Apart: Zoom in
  • Twist Right: Next tab
  • Twist Left: Previous tab

Personally, the biggest benefit is the ease of going to the very next tab with just the touchpad. No need to use keyboard shortcuts like cmd-alt-right or fn-ctrl-down or cmd-tab#. Rotating to the right doesn’t just go to the next tab because if you keep twisting right, you’ll go to the next one and the next one. You could think of it as turning a dial to pick the tab you want. And of course, turning the dial back in the same motion switches back to the previous tab.

So if all that sounds interesting and you want to try, make sure you have one of these machines before downloading:

  • MacBook Pro from this year (either early-2008 model or the new late-2008 ones)
  • MacBook Air (both models from 2008)
  • MacBook from late 2008 (the new aluminum ones)

Firefox 3.1 Beta 2 “pre” with Multi-Touch Gestures – OS X only [build.mozilla.org]
Edit: This feature has been in “trunk” since Oct. 23. Firefox 3.1 will have this feature, and the upcoming milestone, Firefox 3.1 Beta 2, will have it. If you want to grab a version now, you can use a nightly build [ftp.mozilla.org].

Thanks again Tom Dyas for working on this feature! :D

78 Comments | Tags: Apple, Mozilla