Howto: Compiz, XGL on Ubuntu for the morbidly lazy

Last Updated: Jun 8, 2006
Want a more up-to-date compiz? Read a follow-up here.
Overview
Goal: Install Compiz and Xgl on top of Gnome or KDE.
Pros:
- No compiling, all packages downloaded from Ubuntu repositories.
- Userspace compiz startup configuration.
- Works with both fglrx/ATI and Nvidia cards.
- Cooler X functionality, more responsive GUI.
- Impress your friends.
- You know you’ve been aching to try it.
Cons:
- Recommended dist-upgrade to Dapper.
- Requires proprietary 3d acceleration drivers, reasonable card.
- Beta and somewhat buggy software.
- Video playback issues (mostly on ATI cards).
- Getting your feet wet.
An Oh-So-Skippable Intro
Compiz.
Maybe you’ve heard the buzz, the pictures and videos, and spent the past few weeks in absolute agony over the coolness of it all. Okay, maybe you haven’t - but I have. I could rant on and on about why this is the absolute coolest thing ever. An OpenGL powered desktop, Composite, OSX-rivalling effects, and works on ATI cards? At first I thought it to be too good to be true. Yet, there are the screenshots, the forum posts, and everywhere people seem to be talking about it. So why not give it a shot?
The problem is, I’m lazy. I don’t want to dirty up /opt/, don’t want to cvs X.org, don’t want to hack anything I’ll have to remove later. So when the first round of make-filled instructions came out, I waited. If you’re a little less excited than I am, perhaps you’re thinking of waiting a while until it’s working in Dapper. Here’s the thing: thanks to a few brave souls, it already is. What?! you say? Okay, it’s quite beta, but that’s part of the fun, right? And you won’t have to compile anything, so it’s like beta without the beta. In just 3 steps, we can do it.
That’s not so bad, is it?
One last thing before we start playing: please do not hold me responsible for any possible side effects you may experience from using this tutorial. Remember, often more can be learned from what breaks in the beginning than what works the first time.
The Real Stuff
Note: I will not cover installing proprietary 3d acceleration drivers within the scope of this tutorial, and assume you have them installed already. If you do not have acceleration set up before following this Howto, your Xgl performance will probably be too slow to be usable. However, installing these drivers is quite easy, only requiring a few extra packages and possibly a configuration change. Consult the Ubuntu website and wiki for information on installing nvidia-glx or fglrx.
Step 1.
Let’s add dapper sources to apt. If you are of the ones already running it, move to step two. Otherwise, just throw this line in /etc/apt/sources.list/:
deb http://archive.ubuntu.com/ubuntu/ dapper main universe restricted multiverse
apt-get update, apt-get dist-upgrade, and you’re good to go. As has been mentioned in some feedback, this can take a long time, especially for those without very fast connections. However, I would reccomend it for this tutorial. My main man Exdaix reports that trying to pull down the compiz package on breezy ended up pulling down a lot of dapper packages anyway… so be cool like him, and dist-upgrade. 
Step 2.
Let’s pull down some new stuff. Since around February 15, everything you need should be in two packages. Ubuntu has now split the compiz window manager components into separate packages. Depending on your desktop environment, add compiz-gnome or compiz-kde to this list. Open a terminal, and…
apt-get install xserver-xgl compiz (compiz-gnome or compiz-kde here)
Okay! Compiz and everything we need is installed.
Step 3.
Now, everything we need is ready. We just have to invoke it. My technique of preference is to stick everything in userspace scripts, rather than create symlinks or modify gdm.conf-custom. I do this because (like before) I’m lazy, and would rather not make system-wide changes if I don’t have to. So, open your favorite text editor. Throw this little passage in ~/.Xsession (and create if necessary):
(Credit for the original version of this script goes to http://doc.gwos.org/index.php/Installxgl.)
Note: I have an ATI card. If you are using Nvidia, try replacing Xgl :1 -fullscreen -ac -accel xv -accel glx:pbuffer & with:
Xgl :1 -fullscreen -ac -accel xv:fdo -accel glx:pbuffer &
If you want to run KDE, try replacing gnome-window-decorator with kde-window-decorator, and exec gnome-session with exec startkde.
#!/bin/sh
# Start up Xgl, compiz, and GNOME
# Run Xgl server on :1, on top of normal X
Xgl :1 -fullscreen -ac -accel xv -accel glx:pbuffer &
# Tell subsequent X programs to access the Xgl server at :1
DISPLAY=:1
# Start Compiz window manager
gnome-window-decorator &
compiz gconf decoration wobbly fade minimize cube rotate zoom scale move resize place menu switcher &
# Start GNOME
exec gnome-session
Now make sure it’s +x’d/executable:
chmod +x ~/.Xsession
We have now set up your user X session to start the Xgl acceleration on top of regular X, initialize compiz, and then start GNOME in the new GL-groovified layer. Do note that since GNOME is running on top of our Xgl layer, GNOME and your desktop applications will be running on the Xgl display :1 instead of the usual :0.
Try ‘Er Out!
Let’s see if what we did worked. Now cross your fingers, clamp your eyes shut, and reverently whisper “gui acceleration.” Yes, you’ll have to close this Howto. Try to hold back the tears, however hard that may be. Here’s what we’ll do. In just a moment, log out of GNOME. Then open that menu at the bottom left and change the session: make sure you’ve selected the default session setting, so that our .Xsession file is run.
But wait, where’s my fallback plan? What if things go wrong? If anything breaks or starts acting scary, just close down, reboot, or somehow intervene. If you wish to undo, simply go back to GDM and change the session to “Failsafe Gnome.” The .Xsession file responsible for initializing the Xgl layer should not run, and you can delete it in the comfort of your gui environment. In the worst case, you can log into single user mode from grub and delete the file there. I include this because I know it’s no fun to be left with a non-functioning X configuration without knowing how to undo it - only because I’ve been there so many times. This is not rocket science, but it *should not* torch your system. However, know that there are lots of options.
If things work, you’ll see a checkerboard pattern come up on login, followed by a blue background. The gnome splash screen will then fade and wobble in with the most rockin’ graphics you’ve ever seen. Come right back here and I’ll show you what you can do with your new bling machine. Now, go do it! May the geforce be with you, and all that. 
It Worked!
Hurrah! It’s play time. Now, here’s the deal. In the GNOME “Configuration Editor,” (or gconf-editor), you can start tinkering with all of compiz’s options at runtime. Point gconf-editor to /apps/compiz and start messing around. There are tons of little gems hidden inside of compiz’s configuration structure. On a side note, if you are running GNOME, it is reccomended to disable /apps/panel/global/enable_animations. This will turn off the panel “zoom effect” when clicking launchers, which has been known to slow down and possibly crash compiz. Thanks to micampe.it for this information.
There are a few really cool things you’ll notice for starters. Dragging windows makes them wobbly. To make them stick like in the demonstration video, press Ctrl while dragging. Alt-Tab is enhanced by compiz, and will make your windows transparent and fade as you switch through them. F12 is an Expose clone, scaling all your windows to fit in the screen. Dragging the desktop with Ctrl and Alt held down will rotate the desktop to another workspace. Very cool! You’ll notice that non-responding apps will turn to grayscale, as demonstrated in the video as well.
Additional Resources
The Ubuntu wiki has their own Xgl Howto, which provides another method to achieving Xgl and compiz desktop effects. The Gentoo Wiki Xgl Howto provides a wealth of tweaks and information relevant to any distro. Also, for some good details and troubleshooting information, see their section on Xorg and X11 Transparency.
Known Issues
Video playback experiences vary with Xgl. Workaround: for mplayer users, adding the command line arguments -zoom -vo x11 should give reasonable performance at large window sizes. Adding -hardframedrop to the mix can also help prevent audio sync issues (at the cost of framerate) at sizes too large for your system to smoothly handle.
GNOME panel launch square / zoom effect- resolved. See in the above section. If you experience this annoyance, disable /apps/panel/global/enable_animations in the gconf editor.
About: I am a digital artist and computer geek with interests in Linux, open source design programs, and saving the world. You will find me blogging here about art, life, technology, and other mildly amusing things.
RSS 2.0

