A while ago, I wrote a howto, “Compiz, XGL on Ubuntu for the morbidly lazy,” about installing Compiz on a standard Ubuntu Dapper setup. This worked great for the packaged 0.0.2 version in the Dapper repositories, but while Ubuntu started freezing and preparing for their release, Compiz development blazed ahead and many beautiful new features and improvements came with it. Because of this, I switched over to the cvs version of Compiz and ran it for a long time. Unfortunately, my love of the bleeding-edge caught up to me, as about a month ago it seems that Ubuntu’s also not-updated version of Xgl and the Mesa libraries fell out of compatibility with cvs Compiz.

After several unsuccessful attempts to revert to an older version, I resigned back to normal Metacity until I had the time to look deeper into the problem and find what changes were needed. Long story short, after coming back to it today, I stumbled upon the excellent compiz.net forums, and subsequently RacerII’s howto. RacerII points to another forum member reggaemanu’s (mostly undocumented) repository over at xgl.compiz.info, which contains patched Xgl and Mesa packages. I tried them out today, and they work like a charm!

Obligatory Security Note: in general it is a very bad practice to add third-party apt repositories from an unknown source. Doing so is akin to giving the packager root access to your computer, so is thus a huge security and common sense no-no. Proceed at your own risk in using these packages, and please, do take the time to check things out with your web browser before blindly leaping in, mmkay?

Here’s the sources.list line:

deb http://xgl.compiz.info/ dapper main

Update: since the time of my originally posting this howto, the “community” version of compiz (with their patches and enhancement) has made huge strives in both polish and stability. These two versions have diverted so much that that they should be considered as two distinct options. I highly recommend the community version for it’s cool features and extra eye candy. Both with added community patches and without, Compiz remains a showcase for some of the best and coolest user interface exploration in the Linux desktop world, and a great toy for those who enjoy the bleeding-edge.
For compiz-vanilla (”official” cvs compiz):

sudo apt-get install compiz-vanilla xserver-xgl libgl1-mesa xserver-xorg libglitz-glx1 compiz-vanilla-gnome

For compiz with community enhancements:

sudo apt-get install compiz-core compiz-plugins cgwd cgwd-themes xserver-xgl libgl1-mesa xserver-xorg libglitz-glx1

For either choice, you will want to create an ~/.Xsession file with the following contents, and tailor it to your needs. Uncomment the lines (bolded) suiting your setup.

#!/bin/sh

# Start up Xgl, compiz, and GNOME

# Run Xgl server on :1, on top of normal X

# For an ATI Card:

# Xgl :1 -fullscreen -ac -accel xv -accel glx:pbuffer &

# For an Nvidia Card:

# Xgl :1 -fullscreen -ac -accel xv:fdo -accel glx:pbuffer &

# Tell subsequent X programs to access the Xgl server at :1

DISPLAY=:1

# For compiz-vanilla, g-w-d will be our window manager.

# gnome-window-decorator &

# For community compiz, cgwd will be our window manager.

# cgwd &

# Start compiz-vanilla

#compiz gconf &

# Start community version

#compiz dbus csm &

# Start GNOME

exec gnome-session

To start GNOME with compiz, simply make sure your session in your login manager is set to “Default System Session.”

Awesome! It’s great to be back in compiz-land again, and it looks like a few other things have been smoothed and fixed since I’ve last seen it. For one, video looks like it’s working without mplayer hackery, though on my widescreen laptop it has aspect distortion. On the other hand, 3D is still broken at least on my setup, bringing down the whole X session and sometimes hard-freezing gdm when I try it. Resizing is slower than I remembered it, though other things like notification bubbles are running faster.

Lazy_R writes, “To run (OpenGL/SDL) games properly while running Xgl, you can use xgame. It’s a Perl script to fire up a game in a separate (normal) X session.” Xgame can be found here: http://freshmeat.net/projects/xgame/

One fun puzzler which I realized while playing around today: on my 16:10 widescreen desktop, Compiz still displays the illusion of having all sides of the “cube” workspace rotator equal in size. In other words, all sides (including top and bottom) of the “cube” all fit perfectly into my screen. Logically, this should be impossible. With the widths of the faces all sharing the same longer length, the top of the cube would have to be square - it couldn’t possibly be rectangular like my screen is. My guess is that Compiz accomplishes this illusion with some clever scaling when the change would be hardest to spot. While rotated so that the top of the cube is only slightly visible, the top appears square. When the view is rotated to the very top of the cube however, the face fits the rectangular screen. It’s very funny; I had never thought about it before.

This illusion should hold for the more common 4:3 aspect as well, though it is probably more marked on a widescreen display. Try it out and see for yourself!