GNOME Bugzilla – Bug 81802
Metacity doesn't remember window positions (and other state)
Last modified: 2004-12-22 21:47:04 UTC
Package: metacity Severity: normal Version: 2.3.233.0.200205140359-0 Synopsis: Metacity doesn't remember window positions Bugzilla-Product: metacity Bugzilla-Component: general Description: I am pretty pleased with Metacity, except that it doesn't remember where I placed windows the last time I ran them. I always put my galeon and evolution in the same place (both position and workspace)....sawfish never got the workspace right, but it would position things in the same place. Maybe this is a session management bug, but I'd imagine it is a metacity missing feature. ------- Bug moved to this database by unknown@bugzilla.gnome.org 2002-05-14 18:23 ------- Reassigning to the default owner of the component, hp@redhat.com.
I consider this an undefined/unspecified area. The best thing at the present time is for apps to save their position themselves, but I think a specification for handling this may be better in the end. Apps can't record all relevant state, really. Anyhow, there's no Metacity coding to be done until someone plans how it should work.
Is enhancement a fair title for this? As it stands, most of the core apps are going to have decent sm soon...
*** Bug 84984 has been marked as a duplicate of this bug. ***
*** Bug 95199 has been marked as a duplicate of this bug. ***
*** Bug 95234 has been marked as a duplicate of this bug. ***
BTW, for people who want a workaround, Ross Burton wrote a tool called "Devil's Pie" which uses libwnck to control metacity remotely and provide "matched window" type functionality.
*** Bug 95247 has been marked as a duplicate of this bug. ***
I've made a patch which impliments some of this behavior: http://bugzilla.gnome.org/showattachment.cgi?attach_id=12419 Window history is stored in ~/.metacity/window_history using XML. This is a sample of the format: <metacity_history> <window id="bar" class="XTerm" name="xterm" title="/foo/bar" role="blah" type="normal" num="0"> <geometry x="100" y="100" width="200" height="200" gravity="northwest"/> </window> <window ....> </window> : </metacity_session> Metacity loads this file once during initialization right after it opens the display. The file is written to as Metacity is exiting. It needs to load the file after it has possibly replaced an already running window manager so any changes to the history file are commited. Window history is not consulted or updated on windows which exist when Metacity is starting. When a window is mapped, it is given a number of -1 which means undefined. During placement, the list of windows on the current workspace is scanned for windows with similar class/name/role characteristics. (Scan for windows like that with num 0, 1, 2, 3, etc.) Assign num to the next open slot. Check the history for an entry matching class/name/role/num and retrieve the saved position of the window, if any. If a match is found, scan the list of windows to make sure no window is already in the stored position. If it is, fall back to other placement routines. (First fit then cascade) If a match is not found, fall back to other placement routines. When a window is moved, check the list of similar windows and try to find a lower number which isn't allocated currently. Update the saved state with the new window position. We try to find a smaller window number for this reason: - Open 3 calculators. Move them around and then close the first two. Use the third for a while and move it to a nice spot. Close the final calculator. Where should the calculator start if you open a new one now? It should start where you last left the final calculator before you closed it. Renumbering accomplished that. At the moment, I store the window size as well as the window position, but I make no attempt to restore it. I'm not convinced that should be restored.
*** Bug 97922 has been marked as a duplicate of this bug. ***
I support the request the support for placement history as in sawfish. It is especially important for older software that don't do it themselves. Indeed most apps that I use don't save their window position.
gemi - there's no need to "me too" on bug reports. I have always been in favor of this feature, but only if it can be implemented reliably. Benjamin is working on it. We'll see how it goes.
http://bugzilla.gnome.org/showattachment.cgi?attach_id=13409 This version of the patch works well for me and has been getting good testing.
Created attachment 13455 [details] Small write up on my history patch.
Benjamin - is this the most recent version of your patch, or is that on another bug? (if so should we dup one bug on the other?) I hope to look at this patch in the next week or so.
argh, I'm asking people questions when they aren't on the cc list...
The patch is in bug 91481. We could dupe or make one bug depend on the other...
*** This bug has been marked as a duplicate of 91481 ***