Firefox 1.5 and Tabbed Browsing on OS X
Firefox 1.5, released yesterday, breaks the Cmd+Tab/Cmd+Shift+Tab shortcut for switching tabs that I had grown to love so much and was one of the primary reasons I've stuck with Firefox over Camino and Safari. Instead, Firefox now uses Cmd+Option+Left/Right, which requires use two hands and some hunting around.
Enter keyconfig, an extension designed to allow users to add and modify keyboard shortcuts. A comment on the extention page details how to add next/previous tab functionality to keyconfig using gBrowser.mTabContainer.advanceSelectedTab(±1); Unfortunately, that command didn't allow for looping through tabs, so I modified the code a bit to allow for that functionality. Here it is:
Next Tab
if (gBrowser.mCurrentTab.nextSibling)
gBrowser.mTabContainer.advanceSelectedTab(1);
else
gBrowser.mTabContainer.selectedIndex = 0;
Previous Tab
if (gBrowser.mCurrentTab.previousSibling)
gBrowser.mTabContainer.advanceSelectedTab(-1);
else
while (gBrowser.mCurrentTab.nextSibling)
gBrowser.mTabContainer.selectedIndex++;
Technorati Tags: Firefox, Mozilla, tabs, tabbed browsing, keyconfig, extensions, Mac, OSX, shortcuts, keyboard, user interface, UI








Thom Brooks wrote:
Your 'next tab' code and mine were pretty much word for word, but here's a slight improvement on the 'previous' code. HTH.
// previous tab, cycle to last one if at beginning
if(gBrowser.mCurrentTab.previousSibling)
{
gBrowser.mTabContainer.advanceSelectedTab(-1);
}
else
{
// call method to go to tab:
gBrowser.mTabContainer.selectedIndex = gBrowser.mTabContainer.childNodes.length-1;
}
Thom Brooks
Chicago, IL
Posted on 12-Jan-06 at 10:56 pm | Permalink
Thom Brooks wrote:
Darnit, there's an even simpler solution:
gBrowser.mTabContainer.advanceSelectedTab(1,true);
gBrowser.mTabContainer.advanceSelectedTab(-1,true);
The second argument to the function, which defaults to false, specifies that you want to loop back and forth when you cycle through tabs.
Still, it was a fun programming exercise and taught me about using the DOM Inspector to look at xbl bindings. Firefox is a pretty cool app.
Posted on 13-Jan-06 at 12:45 pm | Permalink