May 6, 2011, 7:06 p.m.
posted by redcraft
Dig into Firefox and change some of its brand livery to something that suits you better.
This hack shows how to scratch the surface of the Firefox rebranding process. You can change many, but not all, of the obvious brand marks that Firefox displays with simple chrome hacks. For a really thorough job, you also need to rebundle the Firefox installer [Hack #28] with new brand information, and that must be done on top of a custom build [Hack #93] . It's not a trivial task to complete systematically. Here, then, are the easy bits.
Core Brand Information
Variations on the word Firefox appear in many places in the user interface: in menu items, in flyover help (tooltips), and even in HTML documents. Many of these places pull in the brand information from two files: brand.dtd and brand.properties. These two files are stored in the en-US.jar file in the install area: the default locale for a U.S. English distribution of Firefox. Pick a new brand name, modify these files in place, restart the browser, and see if the changes you need are completed or not.
Rebranding Bookmarks and Bookmark Text
Create a new Firefox profile with the -CreateProfile command-line option.
Start up that profile and open the Bookmark Manager.
Delete all Firefox bookmarks and bookmark folders.
Shut down Firefox.
Rebranding Icons and Images
Some brand icons are easy to remove; others are not so easy. The simplest thing to do is to override the per-window icons that appear in the top left of the titlebar. They are also displayed by process managers such as Windows Task Manager and the Alt-Tab application picker.
To do this, create the following magic directory hierarchy in the chrome area: icons/default. Here's the full URL of that directory:
In that directory, put icon files whose names match the id of the <window> tag for each Firefox window of interest. On Windows, these files should be .ico files; on Unix/Linux, they're .xpm files. As an example, the mail browser window, which is defined in chrome file browser.xul, has a <window> tag with id="main-window". The matching icon files should therefore be named either main-window.ico or main-window.xpm. To see it work, just restart the browser.
Icon files can be bundled with the installer, with extensions, or simply placed as required. There's more imagery than just icons, though.
On the easy side, there are Firefox images to change in the default theme in classic.jar. Look for icon32.png. There are several in browser.jar as well. There are also images to change in the standard install bundle [Hack #28] . Themes, locales, and extensions contain preview images that give away Firefox's true identity as well.
On the harder side, some copies of the Firefox desktop icons are embedded in the firefox.exe binary. Under Windows, you can replace these resources using a free tool such as Resource Hacker (http://www.users.on.net/johnson/resourcehacker/) or the equally free, but also open source, equivalent Resource Explorer (http://www.wilsonc.demon.co.uk/d7resourceexplorer.htm). On the Macintosh, the BNDL resource information is embedded in the source code, and Firefox source must be edited and recompiled to change this.
Rebranding the User Agent
You can change the browser User Agent string using preferences [Hack #23] . The best place to put that preference change is in the defaults\prefs\firefox.js file in the install area.