A simple theme: Prelude

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.

5 Comments

  1. nameee
    Posted December 29, 2008 at 7:19 pm | Permalink

    Hmmm, clicking on the window borders always brings up the titlebar menu?

  2. Posted December 30, 2008 at 2:41 am | Permalink

    @nameee:

    It always happens if the titlebar is offscreen.

  3. Posted December 30, 2008 at 12:00 pm | Permalink

    Ahaha :)

    I don’t seem to have rounded corners, showing the theme in metacity-theme-viewer?

  4. Posted December 30, 2008 at 1:41 pm | Permalink

    (the theme works fine when actually applied to windows, of course, just not in metacity theme viewer!)

  5. Posted January 12, 2009 at 6:33 pm | Permalink

    I don’t have words to say how awesome this theme is. Thank you very much!

2 Trackbacks

  1. By Theme speed - …for the adult in you on December 29, 2008 at 6:53 pm

    [...] …for the adult in you “Many window managers are like Marshmallow Froot Loops; Metacity is like Cheerios.” Skip to content « A simple theme: Prelude [...]

  2. By The answers page - …for the adult in you on January 12, 2009 at 3:47 am

    [...] would you make a Prelude theme? Answered here and now floating around the [...]