Metacity window-placement patch


Comments:


Note: I no longer maintain this page. Updates are available here: http://chad.glendenin.com/metacity/


Downloads

For Metacity 2.10:
For Metacity 2.8:


This patch for Metacity adds a few window-placement options that can be configured in the graphical gconf-editor or with the gconftool-2 command-line program.

The following options are available:

"first_fit" ("smart" is also accepted)
This is the default Metacity window-placement behavior. In this mode, Metacity will attempt to tile new windows on the screen so that they do not overlap.
"cascade"
This skips Metacity's center/tile behavior and cascades new windows the upper-left corner of the current desktop. It uses Metacity's built-in cascading algorithm (which I find to be incredibly irritating). In my copious free time, I plan to fix the cascade mode so that the windows don't overlap as much and so that they start cascading from a position away from the upper-left corner (so desktop icons are not immediately covered by windows). If I can find a multi-screen system for testing, I may also fix it so that each screen keeps tracks of its own cascading.
"center"
This option will cause Metacity to place each new window at the center of its workspace.
"origin"
In this mode, Metacity will simply place each new window at the origin (the upper-left corner) of its workspace.
"random"
In this mode, Metacity will choose a random position on the screen for a new window.

After installing the patched version of Metacity, you can change the option as follows:

In GNOME 2.10, open Configuration Editor from the following menu:
Applications --> System Tools --> Configuration Editor
Then navigate to the placement_mode key:
/ --> apps --> metacity --> general
Right-click on "placement_mode", choose "Edit Key..." from the pop-up menu, and then set the "Value:" field to the option you want.

To change the option from the command line, do this:
gconftool-2 --type string --set /apps/metacity/general/placement_mode random
(but replace "random" with whichever option you want).


Instructions for compiling with custom ebuild on Gentoo

NOTE: I have not updated these commands for Metacity 2.10, but it should be similar.

These commands need to be run as root, or preceded with a sudo.

You'll need a patch for the version of Metacity that you're going to compile using emerge:
metacity-2.8.6-window-placement.patch
metacity-2.8.8-window-placement.patch
metacity-2.8.13-window-placement.patch
(It may work with a mismatched version, but I haven't tried.)

Add this line to your /etc/make.conf:
PORTDIR_OVERLAY="/usr/local/portage"

Create the directory:
mkdir -p /usr/local/portage/x11-wm

Copy the official metacity build dir over:
cp -a /usr/portage/x11-wm/metacity /usr/local/portage/x11-wm/

Add the patch(es) to the files directory:
cp metacity-2.8.6-window-placement.patch /usr/local/portage/x11-wm/metacity/files/

Replace the ebuild file:
cp -f metacity-2.8.6-r1.ebuild /usr/local/portage/x11-wm/metacity/
(Or just manually add the epatch line to the src_unpack function.)

Update the digest/manifest:
ebuild metacity-2.8.6-r1.ebuild digest

Now you should be able to rebuild Metacity using the usual Portage tools.