Monday, January 02, 2006

Updating a Firefox Theme

Last post, as you may recall, I was having trouble with Firefox 1.5 hanging up my X11 session in Windows. Since fixes for the problems in 1.5 had been put into the nightly builds, I downloaded the January 2 build and replaced FF1.5 with what is formally known as Deer Park Alpha 2.

Now running Alpha releases is generally not considered a Good Thing, but I wanted something more cutting-edge than Fedora Core's current 1.0.6 version of Firefox, and the downloaded version of 1.5 just wasn't working well. Maybe, when Fedora releases 1.5 into the regular updates, the bugs that annoyed me will be removed. For now, though DPA2 seems to work just fine. Of course, if I downloaded the nightly every night, eventually I'd probably hit one that destroyed all of the data on my machine. That's the risk in using Alpha software. So instead I'll just use this version until it breaks.

But that's not really what I wanted to talk about right now. My problem is that I like using the Modern Pinball Theme. (A Theme is the background for Firefox — the look of the icons, the color of the background, that kind of thing.) It's neat, has small icons, and generally is presentable enough that you can take it out in public. The problem, however, is that Modern Pinball won't run on a Firefox version > 1.5. Dear Park Alpha 2 lists itself as Firefox 1.6a1, so Modern Pinball refuses to run. Don't blame the developer, he doesn't want to have to keep up with changes in nightly builds. Here, however, there is an easy fix, unless the Firefox people decide to change the theme installation procedure.

So I did a little search and found a page on developing Firefox Themes. I didn't have to read very far. A theme is stored in a ".jar" file, which is identical in structure to a Zip file except that it ends in a .jar extension instead of .zip.

OK, now to find the FF1.5-compatible version of Pinball. It's located somewhere in the .mozilla/firefox directory. So open up an xterm, and type:

$ cd ~/.mozilla/firefox
$ find . -name "*pinball*"

So the extension is located in ./xyzzy.default/extensions/{NNNN}/chrome/modern_pinball-1.5.1-fx.jar, except that xyzzy and NNNN will be something else on your machine. Let's examine file:

$ cd ./xyzzy.default/extensions/{NNNN}/chrome
$ mkdir t1
$ cd t1
$ unzip ../modern_pinball-1.5.1-fx.jar
$ ls -FC
browser/       contents.rdf  help/     install.rdf  preview.png
communicator/  global/       icon.png  mozapps/     reporter/

Use a text editor to look at the install.rdf file. In it you'll find the lines:


Change the second of these lines to read something like:


save, and exit. Now we need to create an new jar file. This way works:

$ zip -9 -r ~/modern_pinball-1.6.1-fx.jar *

This creates a new .jar file in your home directory.

Now, you may ask, how do I get this file into its proper place for Firefox?

Funny you should ask. The aforementioned page includes a an installer form. Download this form to your computer (otherwise it won't work) and open it up within Firefox using the Ctrl-O option. It will prompt you for the location of a .jar file. Point it toward your modern_pinball-1.6.1-fx.jar file and press Install. This should give you a working copy of the Modern Pinball Theme for Deer Park Alpha, aka, Firefox 1.6a1.

Of course, while you're at it, you could change the icons in the Modern Pinball distribution and make your own theme. But I'm not going to try that now.