Tab Switch Keys in Firefox

I’ve been toying with the idea of using FireFox as my main browser. Despite all of the great features offered by Mac native web browsers, they all seem to possess one great flaw: they’re dogs in the performance department. My current favorite, OmniWeb, regularly consumes 600+ megabytes of resident memory and 2+ gigabytes of virtual memory. This is memory that other, larger, applications like Photoshop would very much like to have. This means there’s a lot of swapping to disk going on. On a laptop this is, in a word, slow. Firefox does not seem to suffer from this problem.

The majority of my qualms with FireFox (i.e. lack of a spell checker) have been corrected with version 2. One glaring omission remains, though. The seemingly Mac-standard keys for switching tabs are completely absent. I’ve finally found a fix for this, though.

Here’s how to fix it.

  • First install the Keyconfig extension.
  • Open the Keyconfig preferences by selecting Tools > Keyconfig
  • Select Keyconfig from the dropdown at the top of the dialog
  • Add a new key and name it Next Tab and select Global
  • Paste the following code into the code entry field:
<code>var tab = gBrowser.mCurrentTab;
if(tab.nextSibling) {
    gBrowser.mTabContainer.advanceSelectedTab(1);
} else {
   gBrowser.mTabContainer.selectedIndex = 0;
}</code>
  • Select OK
  • Add another key, name it Previous Tab and select Golbal
  • Enter the following into the code entry field:
<code>var currentTab = gBrowser.mTabContainer.selectedIndex;
gBrowser.mTabContainer.advanceSelectedTab(-1);
var newTab = gBrowser.mTabContainer.selectedIndex;
if(currentTab == newTab) {
    var count = gBrowser.mTabContainer.childNodes.length;
    gBrowser.mTabContainer.selectedIndex = count - 1;
}</code>
  • Assign keys to the two entries you created. I used ⇧⌘-Left Arrow and ⇧⌘-Right Arrow
  • Close the Keyconfig dialog

Now with any new window these keys should allow you to switch tabs with wrapping at the end.

2 Comments

  1. mateusz f 03/18/2009

    thank you :D

  2. tanuki 12/18/2009

    Thank you! I switched over from Maxthon and am used to pressing F1 for new tab, and F2/F3 for previous/next tab respectively.

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>