Taming Firefox

From WTFwiki
Jump to navigation Jump to search

Firefox steals ram like crazy, when I leave it up for multiple days it's not uncommon to see it at 300 megs in ram. If you have less than 768 megs of ram, you probably want to tune it a little. Also, this is for firefox 2.x as they're pushing pretty hard to get people to migrate off 1.5 these days :(

All of these variables can be set via going to about:config in the location bar.

Memory Usage

  • browser.cache.disk.enable - Set this to false to disable caching to disk
  • browser.cache.memory.enable - Set this to false to disable caching in ram
  • browser.cache.memory.capacity - Add this key to set how much ram the cache can use (in kb)
  • browser.sessionhistory.max_total_viewers - How many pages to store in the forward/back cache (about 4mb each?)
  • browser.sessionhistory.max_entries - how many URLs you can navigate through using the forward/back buttons
  • network.prefetch-next - whether to prefetch the contents of links on the page

I recommend you disable both disk and memory caching. I'm not sure why but this dramatically reduces the memory usage and the need to restart firefox.

Also, I set my sessionhistory.max_votal_viewers to 2.

Tab Bar

Firefox 2 made the tab-bar all stupid; here's some setting to make work like it used to:

  • browser.tabs.tabClipWidth = 0
  • browser.tabs.tabMinWidth = 0
  • browser.tabs.closeButtons = 3

To hide the 'all tabs' button (which just wastes space IMO) add the following to chrome/userChrome.css in your firefox profile directory:

 .tabs-alltabs-stack {
   display: none !important;


Get the firefox 1.5 theme for 2.0 here: https://addons.mozilla.org/en-US/firefox/addon/3479 the 2.0 one is just too ugly to endure...

Vi style bindings

The following instructions are fine evidence that mozilla hates its userbase.

I'm trying to force myself to use vi-style hjkl navigation bindings, but firefox always makes me revert to arrow keys and defeats my resolve. Here's how to fix that:

Find the 'toolkit.js' that your firefox install is using (eg. /usr/local/lib/firefox/chrome/toolkit.jar) and unzip it somewhere. Edit the `content/global/platformHTMLBindings.xml` file and add the following to the 'browser' section:

<handler event="keypress" key="k" command="cmd_scrollLineUp" />
<handler event="keypress" key="j" command="cmd_scrollLineDown" />
<handler event="keypress" key="h" command="cmd_scrollLeft" />
<handler event="keypress" key="l" command="cmd_scrollRight" />

You might also want to disable the arrow navigation buttons. Save the file and zip everything you just extracted back up:

zip -r -0 ../toolkit2.jar .

Then, replace the toolkit.jar with your new one (making a backup is a good idea, probably). Restart firefox and your new key bindings should be live. This is confirmed working with firefox 2.

Now, if you want to rebind the forward/back keys you'll need to install the keyconfig extension. I've rebound the forward/back history keys to Alt+, and Alt+. . Note that even with that extension you can't rebind keys for paging.

See also: Vimperator - Awesome, but kinda hard to use in reality. Hopefully it will mature.

Power Saving

To save power (in theory) consider going into preferences->content->colors and setting a gray textcolor with a black background.