This is in answer to Stuart Langridge’s question about how the XFCE theme Prelude can be ported to Metacity. Here is a quick attempt at porting it; I’ll be referring to that in what follows. In order to install this theme for yourself, do:
- mkdir -p ~/.themes/Prelude/metacity-1
- wget -O ~/.themes/Prelude/metacity-1/metacity-theme-1.xml http://www.gnome.org/~tthurman/pics/metacity/Prelude.xml
I’m not talking about SVG here, because that’s still an experimental technology within Metacity, and I’m not talking much about version 2 of the theme format for simplicity.
We begin with the metadata, which isn’t unusual enough to explain. Next comes the geometry, which is the key to the whole business: we only have the one, and it has rounded corners and no title. We have to mark that there’s no title or Metacity will make space for one even though there’s no instruction to draw it. If we were making a v2 theme, we could specify the degree of rounding, but v1 only allows you to say whether or not rounding is happening on each corner.
After the geometry we declare some draw_ops. These are lists of instructions about how to draw each item. All the draw_ops here are simply coloured rectangles. One of them, “white”, is to draw the whole background of the window, but the entries for buttons stop slightly short in order to give the impression of gaps between the buttons but to leave the gaps clickable. We declare the button colours twice in order to have a slightly lit-up version for the prelight.
I added a blue button for the menu button, but if you wanted you could use “white” there and have the menu button present but invisible. In v2 you would need to declare three other button colours, which could get confusing.
Next, we only have one frame_style and it only draws one piece. The differences between all the possible pieces can get confusing, but here we only wish to draw an enormous white rectangle over the whole window surface, and so we can use the “entire_background” piece and be done with it.
Then we have a frame_style_set which points in all cases to the one frame_style, and after that we simply declare that each window uses this one frame_style_set. And there we have it.
There are many possible improvements, including dimming the button colours when a window isn’t focussed, and perhaps using the colours from the desktop theme instead of white all the time.
Edit: Stuart has tweaked the theme a little and uploaded it to gnome-look here.