[sugar] Experiments with Metacity

Sayamindu Dasgupta sayamindu
Mon Jun 2 06:37:41 EDT 2008


On Mon, May 19, 2008 at 5:14 PM, Marco Pesenti Gritti
<mpgritti at gmail.com> wrote:
> On Mon, May 19, 2008 at 11:41 AM, Marco Pesenti Gritti
> <mpgritti at gmail.com> wrote:
>> Maximize + undecorated might work. It has to be done by each activity.
> We could add an option to make metacity show *no* decoration for
> maximized windows. As long as we have a Close menu on the frame that
> should be desired also for desktop applications.
> Ideally we could figure out a way to make metacity maximize activity
> windows by default, but I can't think of a clean way to do it. One
> problem with doing the maximize in the activity is that it would still
> do so when running on a normal desktop.

I tried the alternative of modifying metacity instead of playing
around with the activities.
My plan is to make metacity behave a little differently (ie: maximize
and undecorate any window with the hint GDK_WINDOW_TYPE_HINT_NORMAL,
as suggested by Marco in
http://wiki.sugarlabs.org/go/WindowManagement) when it runs inside
Sugar. For this, I think a possible way forward is to have
olpc-session export a environment variable SUGAR_SESSION_RUNNING=1,
which would be checked by metacity before it goes into the "sugary
mode" [1]. Does this sound sane ?

For now, I have implemented this (sans the check for
SUGAR_SESSION_RUNNING) - the relevant patch for metacity is at

A RPM of the patched version of metacity, is available for download
from http://dev.laptop.org/~sayamindu/sugar_metacity/metacity-2.23.21-2.olpc2.i386.rpm
(WARNING: don't install this on your normal desktop machine yet).

Apart from the patch mentioned above, it also:

1. Has gconf support disabled (do we need Gconf support ?)
2. Has compositing enabled (I did it just for fun - check out a
screenshot from the B4 I have

There were a few minor changes needed for sugar - they are at
(In an XO, do a cd /usr/share/sugar/shell; cat sugar.patch -p2 in
order to apply the patch).

Things which have not been resolved yet:
1) Some activities tend to go into full screen mode automatically - I
think I know what is happening here
2) Activity switching does not work yet. Tomeu gave me some pointers
to the relevant portion of sugar code on IRC - I'll try to see what's
3) Some palettes and windows are being wrongly placed (the worst I
have seen till now is something messing up Record horribly - I'll try
to see what's wrong)
4) The mouse cursor theme switches back to the normal (default??) one.
I suppose this can be easily fixed
5) Memory usage with compositing enabled is high (as per my primitive
experiments with "free"). Tomeu mentions that he might have some
workarounds for that.

Some more screenshots (all taken in a B4):
1) http://dev.laptop.org/~sayamindu/sugar_metacity/gucharmap_sugar.png
2) http://dev.laptop.org/~sayamindu/sugar_metacity/gucharmap_sugar2.png


[1] One possible advantage of this is that normal applications which
do not want to run in full screen mode can perhaps simply unset the
SUGAR_SESSION_RUNNING variable. I have not tested out this idea

Sayamindu Dasgupta

More information about the Sugar-devel mailing list