Original Author - Ed Hume
Homepage *
Original MZF Thread
Post #3
Now is a good time for those who started with a
chrome.manifest theme to unpack the jarfile. It is true that you can work entirely within the jarfile without decompressing and recompressing it; but if you want to do that you can do it later. For now, I want to keep us all working on the same structures.
Note - The theme structure we are going to discuss is a
chrome.manifest theme. If the theme structure you see is not what is described in this post, it is likely to be a
contents.rdf theme.
- If the theme you have chosen is a contents.rdf theme, go to the post above and follow those directions.
- If the structure of your theme does not match what is described below, go to the post above, then rejoin us here.
About compression utilities: If you have Windows as your OS, you can use Windows’ own compression utility simply by renaming the jarfile from thistheme-1.0-fx.jar to thistheme-1.0-fx.zip. This gets old fast.
Of compression utilities, I have found that
IZArc is the easiest to use. With this compression utility I can go inside a jarfile without changing its extension. I can open a file inside the jarfile and change it; when I close the file - still compressed inside the jarfile - IZArc will ask me if I want to apply the changes. I usually say yes (7-Zip also does this). The other thing - and this puts it ahead of
WinRAR for me - is that I can set the default output filetype to be a jarfile, saving me some steps.
Whatever you are using, unpack (decompress) the theme’s jarfile now (if you started with a
contents.rdf theme, Firefox has already done the first decompression, so you do nothing at this step).
Now, whether you started with a theme compatible with a
contents.rdf theme or a a
chrome.manifest theme, you should now have a working directory that looks like this:
Code:
(thistheme-1.0-fx.jar)
chrome (a directory)
chrome.manifest
icon.png
install.rdf
preview.png
What Firefox does when it installs the theme is to read the
install.rdf file to learn what to call the thing, what version number to give it, and whether it is compatible with that version of Firefox. It then reads the
chrome manifest to learn where to find the various directories of the theme structure. The icon.png and preview.png files are graphic images (
png = Portable Network Graphic) that the Themes Manager uses.
(An aside: The icon image should be 32 pixels tall and 32 pixels wide. If not, it will be squished or stretched to that size. As for preview.png, varying sizes work, but something around 200x150 pixels does not abuse your system.)
The
chrome directory in an installation package contains just this: another jarfile. With
contents.rdf themes, this is the original jarfile, from which Firefox has extracted install.rdf and the graphics files. It generates its own
chrome.manifest file from a file inside the original package.
***
Now your theme needs in
ID. There are two methods. Method A is clumsy. Method B is easy and easy to use. I have gone over to Method B, but take your choice.
Theme ID, Method A:
Find a
GUID generator (
GUID stands for globally unique identifier). You can Google around to find one. You can go
here or
here for web-based GUID generators. Or you can go to Microsoft’s
GUIDGen page and download their
GUIDGen utility.
Theme ID, Method B:
Make up an email address. Examples are
HiVisGnome@edhume.googlepages.com,
silvermel@pardal.de,
toolbarcontrol@webdesigns.ms11.net (the ID of an extension), etc. You can see why I recommend this method of making an ID.
***
Now we look at the
install.rdf file. We will use
SphereGnome as an example.
Inside
spheregnome-1.5.0.1-fx.jar you will find the structure listed in the codebox above.
Inside
install.rdf you will find:
Code:
<xml>
<RDF>
<Description>
<em>{ded0fc70-7215-4802-afeb-b2982d3e7225}</em>
<em>1.5.0.1</em>
<Target>
<em>
<Description>
<em>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em>
<em>1.4.1</em>
<em>1.5.0.*</em>
</Description>
</em>
<Front>
<em>SphereGnome</em>
<em>A cool theme with pleasant colors. The buttons light up when you pass over them, and change color or change picture when you click on them. The icons are 24x22 and 32x32, making the theme usable for higher-resolution displays. It is also scalable, so if you set your system font to 125% or even 200%, SphereGnome will expand with it. NOTE: To get a dropdown history from a forward or back arrow, right click on it. It's much easier than trying to stab at a little dropdown marker.</em>
<em>Ed Hume (edhume@gmail.com)</em>
<em>Original theme created by Ken S. Lynch.</em>
<em>BlueSphere SVG Icons and others by Vadim Plessky, [url="http://svgicons.sf.net</em>"]<a href="http://svgicons.sf.net</em>" target="_blank"><a href="http://svgicons.sf.net</em>" target="_blank">http://svgicons.sf.net</em>[/url]</a></a>
<em>Additional Tombats font icons by Tom Murphy, [url="http://fonts.tom7.com</em>"]<a href="http://fonts.tom7.com</em>" target="_blank"><a href="http://fonts.tom7.com</em>" target="_blank">http://fonts.tom7.com</em>[/url]</a></a>
<em>http://www.geocities.com/edhume/</em>
<Front>
<em>SphereGnome</em>
</Description>
</RDF>
The
{ded0fc70-7215-4802-afeb-b2982d3e7225} line refers to the
ID of the theme, in this case a GUID. I made this ID before I learned about email-style ID's.
The
{ec8030f7-c20a-464f-9b0e-13a3a9e97384} line refers to the
GUID of Firefox.
You can see the version of the theme, and the minimum and maximum versions of Firefox with which this theme is compatible.
You can also see the
official “name” of the theme. This name can have spaces and apostrophes, but don’t use apostrophes: when I used an apostrophe in the “
Hallowe’en” theme, Mozilla Update choked on it at the oddest times. I had to rename it “
Halloween”. Other names that work are
HiVis Big (notice there is a space in the name) and
SphereGnome_Big.
Note that the
“internal name” should not have spaces or any characters except letters, number, hyphens and underlines. Thus
HiVis Big becomes
HiVisBig, etc.
You can see where I have given credit to the originator of the theme and the original sources of the art used in the theme. Of course, I made some icons myself, but anyone looking at the originals would be able to tell where I made new ones.
For your work-in-progress, make up a new name (for example
My Theme) and put it in the
install.rdf file in place of the original theme’s name. Then make a compatible character string for the internal name (for example
MyTheme).
Using whichever method you choose, make an ID and paste it into
install.rdf in place of the
theme’s ID. Do not touch the
targetApplication GUID, or your theme will not work on Firefox.
Now for
chrome.manifest. Here is chrome.manifest from
SphereGnome 1.8:
Code:
skin global SphereGnome jar:chrome/chrome.jar!/global/
skin help SphereGnome jar:chrome/chrome.jar!/help/
skin mozapps SphereGnome jar:chrome/chrome.jar!/mozapps/
skin browser SphereGnome jar:chrome/chrome.jar!/browser/
skin communicator SphereGnome jar:chrome/chrome.jar!/communicator/
The
first column tells Firefox this relates to a theme. The
second column refers to the
internal directories of the theme. The
global,
help,
mozapps and
browser directories are default directories from Firefox. The
communicator directory is a fossil that supposedly does not need to be there. But once I took it out and my theme didn’t work. OTOH, that was long ago. Perhaps now I’ll try bundling up a theme without it and see how it goes.
The
third column refers to the
internal name of the theme. Get this right or you get “interesting” results when you install your theme.
The
fourth column tells Firefox where to find the various internal directories.
Here,
chrome.manifest is telling Firefox is that all of the directories will be found inside the compressed jarfile
chrome.jar that is located inside the
chrome directory. I have never tried mixing compressed with uncompressed directories, or having different directories in different jarfiles. I don’t know if it will work. I keep them all in one jarfile because it is faster for Firefox to read a smaller compressed file from the hard drive and decompress it in RAM than it is for Firefox to read a longer set of uncompressed files from the hard drive and use them directly.
You will notice that unlike the Firefox-generated
chrome.manifest from a
contents.rdf theme, the
chrome.manifest from this theme does not have a version number. I did this to avoid having to change my
chrome.manifest file every time I do a point upgrade.
So go into the
chrome.manifest file of the theme you have chose and replace its
internal name (e.g. - ThisTheme) with your own (e.g. - MyTheme).
Note - if you go inside the
chrome directory and select all of its contents, then when you right-click to get your context menu, your compression utility will offer to let you create
chrome.zip or
chrome.jar. This is infinitely better than giving it a custom name, since it saves time and potential for errors.
Congratulations. You have just made a potentially installable theme.
In fact, let’s test it. I have an ulterior motive here - actually, two ulterior motives - so do this.
This post has been edited by Seamaiden: 27 October 2007 - 02:16 PM