14 Oct 12

Fixing guake transparency with metacity slow alt-tabbing (ubuntu)

I like guake as my terminal because I can full screen and half screen prettier than the gnome terminal (I can hide the tabs too).
One part that is important for prettiness is transparency. Some will say that this is just eye candy, but it helps me to monitor chatrooms while I program in full screen with 90 percent opacity.
I can only get guake transparency to work by enabling metacity with

gconftool-2 -s '/apps/metacity/general/compositing_manager' --type bool true

But there’s a catch. Enabling metacity makes alt-tabbing take a few seconds on my machine. This is even after you go into compiz settings and set the display delay in the application switcher to zero (which is possibly the most useless feature that ever existed). Turns out the issue is in metacity.

This page goes over the bug and has a patch that is not applied (although I’m still on natty.
I’m copying it here for convenience. You can save it to a file called metacityalttab.patch and put that in the metacity directory you will create in the next step.

Index: metacity-2.30.3/src/core/screen.c
--- metacity-2.30.3.orig/src/core/screen.c 2011-08-30 22:55:19.000000000 +0400
+++ metacity-2.30.3/src/core/screen.c 2011-08-30 23:02:19.000000000 +0400
@@ -1285,7 +1285,6 @@
       entries[i].key = (MetaTabEntryKey) window->xwindow;
       entries[i].title = window->title;

- win_pixbuf = get_window_pixbuf (window, &width, &height);
       if (win_pixbuf == NULL)
         entries[i].icon = g_object_ref (window->icon);

You can then download the source, patch, build and install with this

#patch an apt-get package (metacity example)
mkdir metacity
cd metacity/
apt-get source metacity
#you may need to play with -p0/-p1
patch -l -p0<metacityalttab.patch
sudo apt-get build-dep metacity
#cant remember, but maybe you need to cd to within the metacity dir for this
#if you are running 64 bit use the 64 bit deb in the same dir
sudo dpkg -i metacity_2.30.3-0ubuntu8_i386.deb

After this, you won’t see the changes until you restart.
If you’re like me and hate restarting more than risking crashing you can try killing metacity and restarting it.
I don’t know if there’s a better way to do this, or if this is even dangerous, but I seem to have survived.
Although, killing metacity will in fact make your windows look really weird for a second.
You might also first disable metacity to be safe.

gconftool-2 -s '/apps/metacity/general/compositing_manager' --type bool false
killall -9 metacity
nohup metacity>/dev/null &
gconftool-2 -s '/apps/metacity/general/compositing_manager' --type bool true

After that alt-tabbing should be fast as it should be, and you should have transparency.
And all was well again.