Two hundred

Bonus 200The Metacity blog has been going now for a little over two years, and this is our two hundredth post. We began at least partly as a place to keep an essay about building the tab list, and we grew from there, picking up the Metacity Journal, release notes, and the Bug of the Day feature along the way. Plenty of people said there was no life in Metacity, and then Iain Holmes came along and implemented the compositor; they said it again, and Owen Taylor created Mutter, and Metacity sprang forth with life anew. And the blog was there to record it all.

We hope you’re enjoying the ride, and we hope you stick with us for the next two hundred and beyond.

Photo © mag3737, cc-by-nc-sa.

Copper: an experiment with CSS

CopperFurther to our previous discussion of CSS, Thomas spent a few hours on sketching out a possible design for a CSS-based theme format, and on representing Daniel Borgmann’s Human theme using it. This is an experiment, all very blue-sky and unofficial, and is quite likely never to lead anywhere.

The first question to resolve is how the interplay of element names, classes, and identifiers applies to us. For example, when styling the close button, is it:

  • a button with id=”close”, or
  • a box with class=”button” and id=”close”, or
  • a close with no class or id attributes?

For simplicity, we went with the last option.  We represent the decorations of a window frame using a set of unique element names arranged into a particular hierarchy.  Almost every element is a simple box; the exception is title which is textual.

We use libccss to parse the theme and also to apply certain of the box styles; this means that this experiment is drawn using Cairo.  (It would have been possible but more complicated to use nbtk for styling, which would have meant this experiment used Clutter.  This is more probably what a final working result would be like.  An attempt was made to use nbtk but some of the more complicated styling options appeared to be currently unsupported.)

libccss supported background images and reasonably complex border drawing.  There were two things we needed which it did not (yet) support, so we had to kludge those in:

  • text styling, for the title; we only bothered to implement justification.  Our approach here is to use a simple text label for the title and to style it, rather than using explicit vector graphics as in v2.  Effects like Human’s shadowing would be implemented by something like CSS3’s text-shadow.  More complicated arrangements like Atlanta’s centred icons would be impossible.
  • the complete CSS box model; only borders were supported.  We made a half-hearted attempt to support margin, and did not even touch padding.  However, in so doing, we made…

A useful discovery: In doing this it became clear that there are two possible ways for a file format to describe vector graphics.  Either the position of everything can be represented using arithmetic expressions, which is how the current Metacity theme format works, or it can use a hierarchical box model, as HTML and CSS do.  One of our stated aims for v3 is ease of editing, and the box model appears to be a better fit for humans to understand in a drag-and-drop editor (as seen, for example, in Inkscape).  Therefore, if we do not adopt SVG or CSS for v3, it may be worthwhile to look into box-based layout models even in a custom format.

Here’s one draft of the CSS for Human, and the results of processing it with this hacky and experimental code are shown on the right (with the real thing around it for comparison). Example of CSS-based approximation to the Human theme

Problems and challenges:

  • New properties. We are certainly going to need to invent properties which are unheard of in real CSS. (For example, corners will need to indicate the degree of rounding.) These properties should probably be marked in some way. Mozilla marks its new properties with a leading -moz; perhaps we should do something similar.
  • Dublin Core metadata. This could be implemented using custom properties on the toplevel “theme” element, representing the author, licence, and so on.
  • Named colours (especially those which refer to the GTK theme).  libccss does not allow new colour names to be defined; perhaps we should ask for this.  On the other hand, it does allow new callback functions to be created, so that you can write color: gtk("bg-selected") or something.  This allows us to get the same effect at least within the CSS.  However…
  • Pixmaps.  This system is well-suited to defining pixmap themes, which are at least fast, easy to understand, and simple to manipulate.  However, they are generally discouraged because they scale badly and don’t recolour well when the GTK colours change.  There are two possible workarounds:
    • Introduce custom properties to scale and colourise the pixmaps as appropriate.  v2 is already capable of pixmap colourisation (it’s used quite heavily in Crux, since that is a pixmap theme, but rarely elsewhere).
    • Use SVG images instead.  This immediately brings up the problem of how to style these images: we could of course use this very CSS to style them, but then our custom callback functions to get GTK colours would still need to be honoured somehow.

Conclusions:

  • CSS has possibilities as a window border format: it is a standard and well-understood format and there are plenty of tools around to edit and parse it. However, it is certainly not as powerful as v2 and probably cannot be.  That may not be a problem, as we said before.
  • As somebody mentioned earlier, research is needed to discover which features of v2 are commonly used, and therefore necessary in any possible v3.  We need to make a big collection of themes and score each feature with how heavily it is used.
  • Box-based layout is simpler for humans to edit (and perhaps to understand in general) than expression-based layout.

Photo © rogdorf, cc-by-nc-sa.

The window menu

French Woodland StrawberryThe window menu is the menu you see when you click the menu button (which usually has the window icon on it), or right-click the titlebar. An identical menu appears when you right-click an application’s entry in the task switcher on the panel, although this menu is owned by libwnck rather than Metacity and is manually synchonised. The contents of both menus are currently fixed. Let’s treat them as the same menu.

The menu currently has around a dozen options.  What is the optimum length for this menu?

These are the current contents. Which of these should not be in the menu by default?

  • Minimise
  • Maximise
  • Move
  • Resize
  • Always on top (checkbox)
  • On every workspace / On only this workspace (radio buttons) ★
  • Move to workspace above, to the right, below, to the left (four separate options, only the applicable ones being visible) ★
  • Move to another workspace (leading to a submenu) ★
  • Close

Some say that the workspace options (★) are overkill. They are by far the most complicated options in the menu, and they take up a large amount of space even for people who do use workspaces.  Perhaps that’s not everyone; if workspaces are something that only advanced users are aware of, maybe these options ought to be enabled separately.

There are other things we could put on the window menu, if it doesn’t get too crowded.  What extra options would you like to see there?

  • Take a screenshot of this window
  • Share this window with another user using VNC
  • Screencast this window and upload it somewhere using Istanbul
  • Anything you can bind a keystroke to.  (Nargery: This would be kept as a hint on the root window, encoded either as a keybinding name (e.g. “toggle_shaded“) or as a representation of an EWMH command.)
  • Similarly, application-specific options, given in a hint on the window itself: so your music player could have play, pause, and so on when you clicked its entry in the task switcher; consider how this could move towards replacing permanent notification applets, evolving into being part of notifisation in Metacity 2, and how useful it might be in gnome-shell.
  • By analogy with right-clicking on the desktop allowing you to set the wallpaper, perhaps “Edit window borders“, which would take you to a dialogue which let you reorder the buttons, modify which user-chosen options were in the window menu, pick a window border theme, and perhaps even do some light theme editing.
  • …your ideas here…

Photo © Beautiful Rust, cc-by-nc-nd.

Towards a third version of the theme format: some design goals

Eggistentialism 1.5 or Three of a Perfect PairWhen we add features to the theme format, they must be added all in one go for reasons which were explained earlier. We are currently on version 2 of the theme format. In case there is ever a version 3, here are some of our design goals.  Not all of these may necessarily be met when and if it happens.  These are not in order of importance.

  1. Standard format. If possible, it should use standard file formats rather than custom ones.  This helps build tools, it helps code reuse, and it helps users learn the format.
  2. Editable. It should be designed such that it’s possible to write a theme editor which is easy to understand and use.
  3. Delegation. It would be useful if at least some of the code to parse and render the theme files was in a pre-existing library rather than being part of Metacity itself.
  4. Shareability. It should be at least possible to use the same theme format with various other window managers, which could perhaps be helped by keeping the code in an LGPL library.
  5. Single file. There should be a standard format for keeping all files associated with a theme in a single file, at least for both distribution and installation.  This will save the end user from ever having to deal with tar or zip.
  6. Subthemes. It should be possible to write a theme which inherits some of its attributes from an existing parent theme.
  7. Named colours. It should be possible to give identifiers and descriptions to a subset of colour constants so that the theme artist can override them on the fly.  (This is perhaps already solved given that we can use colours out of GTK themes.)
  8. Well-defined metadata. There should be visible metadata, including licence identifiers, which can contain a list of all authors as a theme gets remixed.  Theme editors should make it easy to keep this up to date.  In keeping with our use of standard formats, we should probably use Dublin Core for the fields and perhaps the same identifiers that DOAP uses for licences.  The casual theme artist should never see any of this, of course.
  9. Upgrade path. It should be possible to convert themes in version 1 or version 2 format to version 3 format automatically.  Conversion from other WM’s formats would be a nice touch.
  10. Minimum power. We don’t need to be able to do everything that v2 can do.  We do need to be able to do everything that is commonly done in v2.  (For example, v2 allows you to have a title “centred” ⅔ of the way across the titlebar.  This has probably never been used, and it’s no big problem if v3 can’t do it.  If it can’t centre the title in the middle, that’s more of a problem.)
  11. Maximum power. It should not be possible for the theme to get in the user’s way.  For example, it should not be possible to write a theme which obscures the contents of windows; otherwise it would not be possible to switch away from it.  Neither should it be possible to solve the Towers of Hanoi in the theme engine.  People have better things to do with their time.

Your thoughts on these and your suggestions for other goals are welcome, gentle reader.

Photo copyright © bitzcelt, cc-by-nc-nd.

Window matching experiment

Saint Patrick's Day MatchesAt the Collabora party, Robert Ancell asked me how difficult it would be to implement window matching in Metacity. I decided this was an interesting question and spent an hour and a half today working on it. The results are now in the matching branch in GNOME git. If you’d like to download it and give it a try, please feel free.

It currently saves configuration data in a keyfile which contains one group per window, in this format:

[xlogo]
x=287
y=178
w=250
h=231

This isn’t necessarily how it will end up: we could use GConf or perhaps some database-like format. It uses a modified version of the system suggested by Hongli Lai: if WM_WINDOW_ROLE is set, we use that to recognise the window, otherwise we use the window title– otherwise programs like xclock wouldn’t be matchable. The role or title is currently represented by the group name in the keyfile.  The keyfile is saved at ~/.cache/metacity/matching.conf.

The system stores the position and size of every window at the moment it was closed.  There is no need to edit configuration files by hand.

There are inevitably some caveats:

  • There is a bug such that when windows are restored they are offset by the size of the top-left hand corner of the frame.  (In other words, the coordinates are misinterpreted as the client window’s position, not the frame’s.)
  • I haven’t tested this for scalability at all.  Keyfiles might be very inefficient when you have hundreds of records for all I know.
  • It doesn’t know about workspaces, and it should; this will probably be the next thing I add.
  • If your window was minimised or maximised, this will not be restored, and it should be.  This will probably be the next thing after that.
  • It might not be the best idea to write out the keyfile on every window close.  Probably better to keep it in memory until the WM exits.
  • It might be useful to have a switch on the window menu to lock the position and size so it restores the same way when you reload it, in case you move it.  On the other hand, this sounds like crack.

Should this branch be merged when the bugs are ironed out? Should it replace WM-based session files? These are good and interesting questions and ones we should discuss.  Tune in next time, gentle reader!  Or better, comment below.

Photo © Bob Fornal, cc-by-nc-sa.

Notes from Gran Canaria

Gran Canaria Desktop Summit

Lots of happy buzz about window managers here at the desktop summit.  Some things people have said:

  • Someone asked about implementing window matching.  It’s always been our policy that it should be done with an external tool, but policies can of course be rethought.  We might implement it in a branch and see whether anyone likes it.
  • People are very excited about Mutter.
  • Some concern was expressed by distros about whether enough machines will be capable of running gnome-shell: not just rather old machines but new ones which don’t have drivers yet.  Some interest in a version that uses software rendering.
  • Owen Taylor’s work on the git migration and on gnome-shell got a standing ovation at the AGM.
  • Several patches got reviewed and committed at last in hack sessions.
  • Some discussion of the use of CSS in theming.
  • Someone raised the idea of a generalised EWMH testing suite that can be used with Metacity or Mutter.  This sounds like a sterling idea.

In addition,

  • the rpnparser branch (which is a simpler and faster theme expression parser) is still viable, but since the theme format for Mutter isn’t decided, it doesn’t really make sense to merge it.  But perhaps it still belongs in Metacity 2.  What are your thoughts, gentle reader?
  • the squib of the day section in the blog only deals with enhancements, and since enhancements in Metacity are less likely and moving things to Mutter is more likely, this section may be on hiatus for a bit.

Photo © jcorrius, cc-by.

Recent Mutter and Metacity activity

"Monumento à Mãe" StatueHere’s a quick roundup of recent happenings with Mutter and Metacity.

Photo © Fernando Ariotti, cc-by-nc-nd.

Vectacity as CSS

Coloured boxesDavyd Madeley made an interesting suggestion for redesigning the theme format.  Assuming, as seems likely, we end up using Clutter, there’s no need to specify the structure of a window, which would need SVG.  After all, all windows have a basically similar structure.  Instead, we could style any item on the window usinga CSS file, parsed by libccss.

Don’t want a titlebar?
#titlebar {
height: 0;
}

Want a red background on the close button?
button#close {
background-color: red;
}

And so on.  I think this is an interesting idea because it seems comprehensive enough to capture all the problems we face in theme design.  I’m wondering whether it’s perhaps more powerful than necessary and whether it could cause themes to be able to be disruptive, though.

Photo © Sarah G, cc-by.

The future of…

Mother And Infant StatueThe future of the project: It’s fairly clear now that Mutter will be an alternative window manager in GNOME 2.28, and the only window manager in GNOME 3.  It is therefore taking over the reins from Metacity 2: effectively, Mutter is Metacity 3.

But what is to happen to Metacity 2?  Your chronicler believes that the community is better served by working on Mutter, and will do so.  Metacity 2 will not be actively developed, other than for bug fixes.  It is possible that some people out there would like Metacity 2 to continue, and if so they are welcome to fork the project and take over, and your chronicler will offer them as much support in doing so as possible.

The future of the bug list: There are five hundred bugs open against Metacity, more than one maintainer can humanly tackle.  Rather than simply closing them all, I propose working through them ten at a time and deciding for each one whether:

  • alreadyfixed: it is already fixed in Mutter or gnome-shell (this is true of several enhancement requests), and so should be marked WORKSFORME or similar
  • reassign: it is a Metacity bug that can be reproduced in Mutter, and should therefore be reassigned
  • enhancement: it is an enhancement request which Mutter or gnome-shell could take on board; these should be discussed on the mutter-list and perhaps also in the squib of the day feature on this blog;
  • metacity: it is a bug which should be fixed both in Metacity 2 and in Mutter;
  • wontfix: it is an enhancement request which we WONTFIX.

These could be done as we go along, or could be marked with the relevant keywords and then group-edited.  Gentle reader, might you be willing to take on a block or two?

How can we best organise this?  Should we use the wiki and assign blocks to people?  Those of you here at GCDS, would you like to get into a room somewhere and work through the list together?

The future of this blog: I want this blog to continue.  I would like to expand it beyond its current focus:

  • to include discussion of Mutter as well, obviously
  • to include Mutter data in the Metacity Journal posts (these are largely automated and only edited by a human)
  • to include news of interesting developments in window management (such as the current debate over compositor-specific hints in the EWMH)
  • to have guest bloggers occasionally (again, any volunteers?)

One danger is that your chronicler spends more of their time writing blog posts than fixing code.  Suggestions for solving this problem are welcome.  It may involve delegation to someone who is better at blogging than coding.

Photo © Greg Emel, cc-by-nc-sa.

Squib of the day: read your email

Metacity’s window menu is less than cluttered; there’s room for a fair amount of extra options in there. One that was recently suggested is an option to take a screenshot of the current window.  However, that can be done already using keybindings.  What about more adventurous use of the menus?

GNOME bug 472370 makes the reasonable suggestion that Metacity should contain an IMAP client. It would be possible to read your GMail inbox right from the system menu of any window. After all, Zawinski’s law points out that programs which cannot read email are overtaken by programs that can, and if Compiz contains an email client, your chronicler has yet to hear of it.

This appears to be a perfectly sensible idea, and our prototype is demonstrated in this post.  It will be included in the next unstable version. After we iron all the bugs out of this, we might deal with focus fixes if we have the time.

Bad Behavior has blocked 253 access attempts in the last 7 days.

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported.