I’m a really big fan of CLI software, but sometimes you just need a GUI app, like a web browser (lynx would be so awesome if someone made a real-time image-to-ASCII-art converter plugin…I’ll work on that some day). I spend a lot of time in my gnome terminal (I use the awesome GNOME Shell) and the only keybinds I really need are:
- Alt+Q – Previous Tab
- Alt+W – Next Tab
- Alt+Shift+Q – Move Tab Left
- Alt+Shift+W – Move Tab Right
Using these, I feel every bit as efficient as when I used to use tiling WMs (I used to really like Awesome and wmii). However, Firefox lacks these shortcuts or the ability to customize them, and my fingers eventually got sick of the keyboard yoga required to tab around in Firefox (Ctrl+Tab / Ctrl+Shift+Tab by default). I knew there must be a better way, and I was right. The best part is that I didn’t even have to re-compile FF, which would have been ridiculous, but I’ve been known to do worse things in the name of making software work exactly like I need it to (one of the greatest parts of FOSS, IMO).
To pull off this hack, we’re going to grab the newest version of the KeyConfig Firefox extension. The version on the official Firefox add-ons site is a bit out of date and doesn’t work with FF6 properly. You might need to install Nightly Tester Tools and do the “override add-on compatibility” dance if you find that Firefox won’t let you install it.
Once you have that all set and have restarted Firefox, hit Ctrl+Shift+F12 to open up KeyConfig. We’re going to add two keys:
- name: Previous Tab, id: xxx_key1_Previous Tab, shortcut: Alt+Q, code:
gBrowser.mTabContainer.advanceSelectedTab(-1, true);
- name: Previous Tab, id: xxx_key1_Next Tab, shortcut: Alt+W, code:
gBrowser.mTabContainer.advanceSelectedTab(1, true);
Then just apply and let dry. Try holding Alt and using “Q” or “W” to cycle through your tabs now! Amazing!
If you want to mess with some different keys, you’ll probably want to dig through the latest browser2xul document and figure out what the actual code you need to pass to Firefox would be. Here is the one that I struck gold with. YMMV, and happy hacking!