How to Add New Firefox Hotkeys That Switch Between Tabs

We previously talked about how to customize the Google Chrome hotkeys. You can also configure the Firefox keyboard shortcuts with a few extensions. One you should try out is Dorando keyconfig. With this add-on you can not only configure the default hotkeys in Firefox, but set up entirely new ones.

First, open the Dorando keyconfig page on the Mozilla site to add it to the browser. Then enter ‘about:config’ in the Firefox address bar. Click Options beside the Dorando keyconfig extension to open the window below.

dorando keyconfig3

That includes a list of Firefox hotkeys for you to customize. To adjust the keyboard shortcut for one of the default hotkeys, select it on the window and click inside its text box. Then press an alternative keyboard hotkey and click Apply. Click the Close button to exit window, and then press the new keyboard shortcut to try it out.

However, you can also add entirely new ones by adding some code. As an example, let’s set up two new Ctrl + Right arrow and Ctrl + Left arrow hotkeys that switch between the page tabs when you press them. This would be an alternative to pressing Ctrl + 1, Ctrl + 2, etc. To do that, press the Add new key button to open the window shown below.

dorando keyconfig

First, enter the title ‘Switch tab’ for the hotkey in the Name text box. Copy and paste the following into the code text below that gBrowser.mTabContainer.advanceSelectedTab(1,true);. Press OK to close the window, and click the text box beside the Apply button. Then you should press Ctrl + Right arrow key to enter that in the text box, and click the Apply button.

dorando keyconfig2

Close the Keyconfig window. Open a few tabs in Firefox, and press the new Ctrl + Right arrow key hotkey. That will select the tab right of the active tab. Thus, you can keep pressing the key to cycle through the tabs from left to right.

In much the same way, you can set up a hotkey that cycles through the tabs from right to left by repeating the same steps with this code gBrowser.mTabContainer.advanceSelectedTab(-1,true);. Give that hotkey the title ‘Switch tab 2.’ Then you should also give it a Ctrl + Left arrow key hotkey. Pressing that keyboard shortcut will then open the page tab left of the active one.

So Keyconfig is a great add-on to customize the Firefox hotkeys with. You can also configure the browser’s hotkeys with other Firefox extensions such as Keybinder, but you can’t set up entirely new keyboard shortcuts with that add-on.

Posted by Matthew on July 6, 2016

Leave a Reply

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