Hacking metacity – Remove Window decorations.

I recently switched back from awesome to GNOME, and I was missing the missing window decorations. No, seriously. I resize, minimize, maximize, close, and all the other things you can do with windows, with the keyboard, so having a window decoration was just sucking space.

I found out you can disable window decorations with compiz. Well, I don’t want to use compiz. Metacity doesn’t suck. So after doing some research and hacking in the gconf settings I know now that there’s no configuration setting that allows disabling window decorations the easy way. So, I downloaded the latest source and started hacking.

The source of metacity is structured very nicely.

src/
|-- compositor
|-- core
|-- include
|-- themes
|   |-- AgingGorilla
|   |-- Atlanta
|   |-- Bright
|   |-- Crux
|   |-- Esco
|   |-- Metabox
|   |-- Simple
|   `-- themes
|-- tools
|-- ui
`-- wm-tester

My first intuition told me to search in core/ and I was rewarded directly, as there was the window-props.c .
After a short search I found the critical line, and modified it accordingly.

Here the `diff` output from the terminal:

682c682
<   window->mwm_decorated = FALSE;

>   window->mwm_decorated = TRUE;

And, here’s the more readable git diff of the metacity repository (METACITY_2_30_3-8-gbfacc7e):

diff --git a/src/core/window-props.c b/src/core/window-props.c
index b7b3e12..7487071 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -679,7 +679,7 @@ reload_mwm_hints (MetaWindow    *window,
 {
   MotifWmHints *hints;
 
-  window->mwm_decorated = TRUE;
+  window->mwm_decorated = FALSE;
   window->mwm_border_only = FALSE;
   window->mwm_has_close_func = TRUE;
   window->mwm_has_minimize_func = TRUE;

Explanation:
I have only set a variable to FALSE, to turn off rendering window decorations.

I compiled the code and installed it, and then I simply restarted my GNOME session, and voilá my window decorations were gone.

Feel free to copy, and modify my changes.

UPDATE: I submitted a better version as a patch upstream.

Appendix
I also found some forum topics on this topic, which were rather buggy workarounds. Please, don’t touch them.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>