Session management

It’s time to talk about session management. It might even be interesting.

The basic idea is that when you log in, you want your desktop to look like it did when you logged out. There is a program called the session manager which starts up all the programs which were running when you logged out, and tells them that they’re being restored. It is smart enough to call the window manager first. The specs which govern this, if you really want to read them, are §5 of the ICCCM and XSMP.

You can compile Metacity with session management turned off, but most people don’t. If you’re running a copy of Metacity which knows about session management, and you’re running under a session manager, then the session manager will tell Metacity to save state when you log out, and give it a session string. Metacity will write out a single file named after that string, including the position, minimised/maximised state, size, and so on of each window. When you log back in, the session manager tells Metacity the name of the file, and it will reload all the information.

This is the icky part: remember how the session runs the window manager before any of the applications? Metacity now has a list of the windows that were open before you logged out, and none of them have been opened again yet, because the applications haven’t run. So Metacity keeps a list, and when the applications start and open their windows, Metacity will place them how they were beforehand.

So what we have here is window matching. Gentle reader, when you hear the words “window matching”, you have my permission to scream bloody murder. There is simply currently no good way to do it, and so we don’t. What do we match on? The window’s title, its role, its class, or what? We don’t do window matching in Metacity, because there is no good way to do it at present. Rather, we leave that to power-user tools like Devil’s Pie, where people who really want this behaviour and have enough time to specify exactly what they want in detail can do so.

But, as you’ve noted, we do do window matching in Metacity: we just pretend we don’t. And we don’t in general, but session management forces our hand. Every time we open a window (if there’s session management going on), we make a list of session windows which were opened by the application with the same session client ID and have the same resource name and class and the same role setting. Then we use the settings of any matching window which has the same title; if we don’t find one, we use the settings of any matching window which has the same type; if we don’t find one, we give up on window matching. (“The same” above includes the case where they’re both null.)

That was pretty complicated. Add to that complexity the fact that most applications don’t even set the role and resource settings to anything useful, and you begin to see why we (supposedly) don’t do window matching in Metacity.

Now, there are five possible ways forward for us:

1) Carry on as we are.

But we have this directory “~/.metacity”, which clutters up people’s home directories and has to be cleared if they want to remove all state. “~/.metacity” only ever contains the directory “sessions”, anyway.

2) Move metacity session data to “~/.gnome2/metacity/session”.

You might think this was the obvious way forward, but it isn’t going to happen because…

3) Move metacity session data to “~/.config/metacity/session”.

As GNOME bug 518596 points out, freedesktop.org is standardising hidden directory names across all desktops. The name to use based on this idea depends whether our session files are configuration data, cached data, or some other kind of data; this has been discussed on that bug and consensus seems to be that they’re configuration data.

However, if we’re going to move to another directory, we should also consider:

4) Move metacity session data to “~/.config/metacity/session” and change the format.

The existing format is based on GMarkup, but does pretty much exactly what GMarkup is bad at. It is also generally rather inelegant. It would be very simple indeed to replace it with a GKeyFile-based system; there’s almost a one-to-one mapping with the API in many places. We’d know that files in the new place were in the new format and files in the old place in the old, and after a few years perhaps we could drop support for reading back the files in the old place (how long do people keep session files around for, anyway)?

But the most radical solution is:

5) Abolish session management (or at least session management within the window manager).

This suggestion has come from a number of people. The reasons given so far are: XSMP has so many problems that we’re better off not implementing it at all than implementing it partially; we really shouldn’t be even attempting to do this because it involves window matching, which is an impossible problem anyway; Sven Herzberg apparently gave a talk at last year’s GUADEC that said that applications should be responsible for restoring their windows because they know how to do so and the window manager can’t know in general.

Photo by Mark Norman Francis, cc-by-nc.

2008-03-06: Caecilius est in horto, Metacity Journal est in blogo

Ye Olde Fighting Cocks, St Albans. Photo by Gary Houston, public domain.

Releases
2.23.1 went out today. Yay.

Bugs

  • GNOME bug 326156 – the debate over what raise_on_click means in various focus modes rumbles on
  • GNOME bug 358674 (unidirectional maximisation) – Josh Triplett says that the TCA fix doesn’t go far enough, and that we should (also? or only?) consider FMB. Your reasoned responses are most welcome.
  • GNOME bug 520136 – also, unidirectional maximisation should be in the window menu
  • GNOME bug 358866 – gentle readers, does anyone know how to tell vim to use GNU coding conventions?
  • GNOME bug 479107 and GNOME bug 491114 appear to contradict one another. One of them should be closed…
  • GNOME bug 482354 – the question of whether opening up new windows should bring the whole app onto the current workspace dogs us again. Apparently the reason Firefox doesn’t exhibit the problematic behaviour with KDE is that kwin special-cases it!
  • GNOME bug 513281 – a problem with sloppy focus that’s hard to reproduce
  • GNOME bug 519188 – windows created and set to stay on top will lose focus, contrary to what you might expect
  • GNOME bug 520713 from launchpad bug 120818 – maximisation is messed up on xinerama. Your chronicler should cadge some extra screens in order to test these things.
  • GNOME bug 520792 – Jeff Schroeder came on IRC asking why metacity said he didn’t have the composite extension when he did. It turns out that composite+xinerama don’t work together under nvidia. Thomas suggested that Metacity could detect this case and print a helpful message so people were less mystified.

Checkins on trunk

Links

  • You may recall GNOME bug 448183, which was in general about writing programs which did clever window management things when Metacity’s only doing the bare bones, and in particular about a forthcoming window management utility. Well, Mikkel Kamstrup Erlandsen has announced the availability of that tool in his blog (although it hasn’t formally been released).

Translations

  • On branches/gnome-2-22: en_GB by pwithnall, es by jorgegonz
  • On trunk: es by jorgegonz

Photo: Ye Olde Fighting Cocks, St Albans. Photo by Gary Houston, public domain.

2.23.1 released

What is it ?

Metacity is a simple window manager that integrates nicely with GNOME 2.

What’s changed ?

Thanks to Cosimo Cecchi, Jens Granseuer, Jim Huang, Andrea Del Signore, and Thomas Thurman for improvements in this version.

(Cosimo’s patch was very similar to another received from Jason Ribero.)

– Allow horizontal and vertical maximisation using the mouse (Cosimo/Jason) (GNOME bug 358674)
– Allow “spacer” as a value for buttons, for blank space (Andrea) (GNOME bug 509165)
– Remove unused code (Jim)
– refactor preferences handling (Thomas)
– make sure we’re valid C89 (Jens) (GNOME bug 518917)
– some messing with tool scripts (Thomas)

Translations
Jorge González (es), Claude Paroz (fr), Woodman Tuen (zh_HK), Woodman Tuen (zh_TW)

Where can I get it ?

Source code

http://ftp.gnome.org/pub/GNOME/sources/metacity/2.23/

MD5 Sums

16e6ab41744d2c4a17e34e4c558a7efb metacity-2.23.1.tar.bz2
85488ed52516be18316b000b42343ead metacity-2.23.1.tar.gz

2008-03-02: a rather muted Metacity Journal

Fewer things have been happening, but what they’ve lacked in number they’ve made up in excitingness. Excitingosity. Whatever it is.

Bugs

  • GNOME bug 358674 – the venerable unidirectional maximisation bug was closed today, with over fifty comments on the clock, several duplicated bugs, and two factions: FMB, who wanted horizontal or vertical maximisation to happen when you middle or right clicked on the maximise button, and TCA, who wanted them to be titlebar actions. Thomas called the dispute last week for the TCA, and committed one of the patches today. (When one of the comments says “See point F of comment 50”, you can tell the discussion’s been going on for a good while.)
  • GNOME bug 518606 – Metacity did not do what the libwnck documentation said, but it turned out to be because the libwnck documentation was wrong.

Checkins on trunk

Links
Nothing very interesting.

Translations

  • On branches/gnome-2-22: lt by gintas

Photo: Lower Red Lion, St Albans. Photo by Gary Houston, public domain.

2008-02-29: for when your mouse says “Wurlitzer” on the side

Havoc sends along a link to GNOME bug 44927, an excellent answer to the question “But why not just include this patch? It’s only a bit more code!”: “I included this patch [“support >5 mouse buttons”] since it seems harmless.”

Bugs

  • GNOME bug 437910 – there has been a fair amount of interesting discussion off and on about this one. Currently you can resize windows with alt+middle drag, but this is unusable with many laptops. Should we change this to alt+right drag, as some other window managers do? Should we have a general “we don’t have a middle mouse button” flag somewhere? How should we make decisions like this? This is also the first Metacity bug to come up on the Ubuntu brainstorming site; feel free to make suggestions there, incidentally, since we ship on Ubuntu, and we’ll see them and link them here. Raising bugs in GNOME’s bugzilla will certainly find us, though, because they appear here through a script.
  • GNOME bug 468075 – Sven does further work on tracking down this remarkably long-lived bug about maximisation
  • GNOME bug 482354 – Colin Walters updated the patch, which has been waiting for review for a fair while and had rotted. We should decide what to do about this before Firefox 3 comes out, but it’s a major undertaking to make a decision (otherwise it would have happened already).
  • GNOME bug 509165 – first-time contributor Andrea Del Signore provides a patch to add “spacer” as a button type, which went in today.
  • GNOME bug 513944 – a new clue in this segfault, which looks pretty useful (the clue, not the segfault)
  • GNOME bug 517722 – Elijah said that there are many actions done better by a process outside the window manager; Mikkel Kamstrup Erlandsen has a tool called winwrangler which does this, but it is blocking on GNOME bug 518606
  • GNOME bug 519128 – some files from Søren’s compositor were left behind
  • GNOME bug 519188 – a new focus issue

Thomas’s hit list for the next few days: GNOME bug 518606, GNOME bug 513944.

Checkins on trunk

Links

Translations

  • On branches/gnome-2-22: ca by gforcada
  • On trunk: zh_HK by chliao, zh_TW by chliao

Happy Leap Day, everyone.

2008-02-27: Metacity Journal

When things are this busy I should be doing these daily.

Bugs

  • We reported earlier, gentle reader, that the rounded corners preview GNOME bug 460018 was solved in both trunk and the gnome-2-22 branch by Thomas Wood. We made probably the last release of 2.21 specially to include the patch.
  • GNOME bug 490668 – one of the accessibility problems that needs work: immediately after startup, nothing has focus, which breaks Orca. Shouldn’t be hugely difficult to fix. Anyone willing to spare a few braincycles?
  • GNOME bug 509165 – separator values. Andrea has found a new solution which doesn’t involve any problems with the visibility rules. This needs testing, which is due shortly after this post.
  • GNOME bug 517722 – more work on Dietrich’s expand patch.
  • GNOME bug 518325 – someone says a function is broken; Elijah agrees and says it should go away anyway.
  • GNOME bug 518596 – should we not have a .metacity directory? If not, what should we have instead? A post is forthcoming on this blog on the matter.
  • GNOME bug 518608 (launchpad bug 192309) – segfault; needs triage
  • GNOME bug 518629 (launchpad bug 116807) – someone complained that the arrangement of desktops is lost if you remove the applet which arranges the desktops. Since this is the program which actually requests the arrangement, I’m not sure how else it could be, really.
  • GNOME bug 518917 – we are now valid C89 all the way through.

Checkins on branches/gnome-2-22

Checkins on trunk

Links
Nothing much interesting.

Translations

Till next time…

2008-02-20: Metacity Journal (with thanks to Rio!)

Rio is helping me edit the Metacity Journal tonight. Thanks, Rio!

Bugs
It’s been a busy couple of days!

  • GNOME bug 106249 — Matthias comes up with a working patch for the skip_taskbar problem
  • GNOME bug 138290 — Rob thought window placement had its problems, but Thomas wasn’t sure what they were; we need to ask the GIMP folks
  • GNOME bug 151818 — “Open new windows centred”; it’s still really a Devil’s Pie thing
  • GNOME bug 328210 — Alexey Rusakov found a bug in our configure script (we need to make a regression test for this soon)
  • GNOME bug 342565 — should it take effort to move a window away from a xinerama edge
  • GNOME bug 448183 — our EWMH support allowed programs to resize OR move, but not both at once
  • GNOME bug 498812 — appears to have fixed itself :)
  • GNOME bug 515773 — a possibly contentious question: should errors which are reported by Metacity be shown as Metacity errors in the logs, or should we attempt to figure out the name of the broken program and pretend that program produced them?
  • GNOME bug 517722 — new contributor Dietrich Rothe has come up with an interesting idea about windows which expand to the maximum size available

Checkins on trunk

Links

Translations

  • On branches/gnome-2-20: ne by pachimho
  • On branches/gnome-2-22: gl by icq
  • On trunk: fi by ituohela, oc by ymarcheg
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported.