3D Xgl Compiz Eye Candy for Ubuntu/Kubuntu Dapper and NVidia

by Nicholas Petreley

To each his own, but I love eye candy. When I heard that you could get the 3D Xgl and Compiz environment running on Ubuntu/Kubuntu dapper (my default distribution), I immediately searched the web for instructions. Most of the instructions take a reasonably timid approach, which gets your 3D environment running in a test console (the second display, or :1). I'm more adventurous, however, and I immediately went for a total replacement. What follows are instructions for doing the same (updated 09/08/2006).

As the title says, these instructions are for Ubuntu/Kubuntu dapper with an NVidia binary driver. If you are using another distribution or are using an ATI card, you'll have to adjust the instructions or look elsewhere for information. Sorry, but this is what I run, so this is what I know.

As I point out in the comments below, no screen shot can do this eye-candy justice. The fun is how windows boing into view, how they wobble when you move them, how the multi-desktop cube rotates, and so on. But I have included a snaphot file below that shows a terminal in the foreground, and Firefox faded into the background.

Novell has some screenshots and videos at this link.

Install on Ubuntu/Kubuntu

Assuming you are using Ubuntu or Kubuntu dapper, add one or more of the following to your /etc/apt/sources.list file:

deb http://www.beerorkid.com/compiz/ dapper main aiglx
deb http://xgl.compiz.info/ dapper main aiglx
deb http://ubuntu.compiz.net/ dapper main aiglx
deb http://media.blutkind.org/xgl/ dapper main aiglx

I have them all in my sources.list file. That way, if one site happens to go down (and I've found that one or more does become unavailable at times), you have others. If apt-get update gives you trouble, comment out the site that is causing the problem. You can uncomment it later if you like.

Here is a list of the programs you will probably want or need. You probably have nvidia-glx installed already, but I listed it just in case.

Here are the basic installation commands. I tossed in a dist-upgrade just in case you aren't up to date with your distribution.

EDIT: Warning: The rapid development of compiz and cgwd leads to changes in the packages you need to download, so you may find that you have to change the following list of packages to install in order to keep up. I edit this article occassionally to update changes of which I become aware.

One way to keep track is to perform commands like apt-cache search compiz or a similar command for cgwd. This will show you what's available. Be warned, however, that not all of what's available can be installed. Sometimes what you find will be out of date. Just keep trying to install what you find, and read the error messages to get a hint of what to do next.

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install libgl1-mesa libgl1-mesa-dri libglu1-mesa mesa-utils
sudo apt-get install nvidia-glx
sudo apt-get install xserver-xgl compiz compiz-core compiz-gnome compiz-plugins libglitz1 libglitz-glx1
sudo apt-get install cgwd cgwd-themes

The xorg.conf changes

Edit your /etc/X11/xorg.conf file. If you don't already have RenderAccel set, change the video device section to add the line to turn this on. For example (your section may look quite different aside from the driver and RenderAccel lines):

Section "Device"
        Identifier      "NVIDIA Corporation NVIDIA Default Card"
        Driver          "nvidia"
        Option          "SLI"   "Auto"
        Option          "RenderAccel"           "true"
EndSection

Make sure you have the following extensions section in your xorg.conf file. If it isn't there, add it.

Section "Extensions"
        Option  "Composite"     "Enable"
EndSection

Launching Xgl from KDM

Edit /etc/kde3/kdm/kdmrc. Find the following section:

[X-:*-Core]

Comment out the normal X server startup command, and add a line to start the Xgl server. This line is specifically for the NVidia driver. You'll need to do a little of your own digging to find out which line to use if you are using an ATI card.

#ServerCmd=/usr/X11R6/bin/X -br
ServerCmd=/usr/bin/Xgl -fullscreen -ac -accel xv:fbo -accel glx:pbuffer

From now on, every time you start KDM, it should use Xgl instead of the normal X server for KDM and then continue to use Xgl for your GNOME or KDE session.

Launching Xgl from GDM

Edit the /etc/X11/gdm/gdm.conf file (or whatever file your distro uses -- my copy of Ubuntu uses gdm-cdd.conf). Modify it like this:

[servers]
0=Xgl
#0=Standard (comment out this line)

[server-Xgl]
name=Xgl server
command=/usr/bin/Xgl :0 -fullscreen -ac -accel glx:pbuffer -accel xv:pbuffer
flexible=true

From now on, every time you start GDM, it should use Xgl instead of the normal X server for GDM and then continue to use Xgl for your GNOME or KDE session.

Starting Compiz

You no longer need to write your own startup script, since one is supplied in the new packages.

Start KDM or GDM and log in to GNOME or KDE. Open up a terminal window and run the command:

$ compiz-start

You should see some very nice eye candy after a moment. You may not like the default cgwd theme, so run this command to select a new theme. You may also have a menu entry in GNOME and/or KDE to run CGWD Themer. In my KDE installation it's Main Menu->Settings->CGWD Themer.

$ gcompizthemer

If you really want to get into some trouble, you can play with Compiz itself. Start this command:

$ csm

Compiz is far from stable at this point, and some settings can crash the desktop. This utility is for the bold and the restless only.

Final step

If you are comfortable using cgwd in GNOME or KDE, then configure your favorite desktop to start the compiz-start script automatically each time. If you are using KDE, open the System Settings, choose KDE Components, and then click the Add button in Autostart Applications to add this script.

If you are using GNOME, select System->Preferences->Sessions from the main menu. Click on the Startup Programs tab and click the Add button to add compiz-start as one of the startup scripts.

Why doesn't this work in Fluxbox?

I often use Fluxbox as a minimal window manager. You may use one of several other window managers. You can't run Compiz as a replacement window manager for something like Fluxbox because Fluxbox is the desktop environment that has all the Fluxbox features you like. Fluxbox is not a desktop environment with a drop-in window manager like GNOME, KDE or XFCE. Desktop environments like GNOME, KDE and XFCE all run their features outside the window manager. You can replace the window manager in GNOME, KDE and XFCE with minimal impact.

By "minimal impact" I mean that you'll still have the desktop background, panel, file managers, etc. that normally work with GNOME or KDE. But the new window manager will affect many other things. The hotkeys you use will change dramatically unless you take the time and trouble to customize them all (you can use the gconf editor to do this). Maybe someday the Fluxbox (and other window manager) maintainers will tap into Xgl and add fancy features. Until then, if you want the 3D eye-candy, use cgwd/compiz as your window manager with other desktop environments.

In the meantime, the above instructions may cause you trouble if you want to launch sessions other than KDE, GNOME or XFCE from KDM or GDM. I can still launch these sessions without problems, but it soothes my concience to warn you that your experience may vary.

Tips

You will discover most of the features of cgwd/compiz as you play around with it. Here's one important tip: This combination will override your virtual desktop settings. I find that I don't use the virtual desktop switcher anymore. I simply use Ctrl-Alt-Right to switch to the next desktop, and Ctrl-Alt-Left to switch to the previous one. You can also press Ctrl-Alt-PgDn to minimize (somewhat) the virtual desktop span. Keep holding down Ctrl-Alt and then use the right and left arrows to move between desktops.

Some actions are unintuitive and alarming, and you may suddenly find that all your windows are on the same screen, or that your windows disappear. The Escape key usually gets you back to where you were. Sometimes you have to explore a bit to undo the unexpected effects of this or that keystroke or mouse movement.

The cgwd program is a work in progress, and it is changing quickly. If you create your own theme and save it, be prepared to recreate it after you upgrade to a newer version of cgwd. I had window buttons disappear almost at random after I upgraded cgwd. I chose a standard theme and customized it again, after which this problem disappeared.

KDE Tip

Choose your style and turn off your GUI effects. At the very least, turn off the menu drop shadow. It interferes with the Compiz effect. I turned off all GUI effects and that gave me the best results.

GNOME Tip

Choose your control style before you start using Compiz and Cgwd. You may be luckier than I am, but if I try to change control styles while Compiz is running, GNOME features crash left and right.

Possible problem

The order in which you install things makes a difference. If Compiz doesn't work for you (you'll usually get a message about a missing symbol, but sometimes you won't get a message at all), then you need to reinstall something to restore the library with the symbol.

I happened to install a custom kernel among other things, and Compiz stopped working. It turned out that the problem occurred because I installed the downloaded proprietary NVidia driver, which overwrites some of the Ubuntu GLX files. I reinstalled a number of packages, including the following:

sudo apt-get install --reinstall nvidia-glx libgl1-mesa-dri libglu1-mesa mesa-utils

I believe this fixed the problem for me. It is possible that I reinstalled other packages (see above for the packages you need -- you can always reinstall all of them).

EDIT: Some of the latest NVidia drivers now mess with library links that can break Xgl/Compiz/cgwd. I find that on some systems, I have to restore these links:

/usr/lib/libGL.so -> libGL.so.1
/usr/lib/libGL.so.1 -> libGL.so.1.2

It seems to break Xgl/Compiz/cgwd to have these libraries point to the NVidia-specific library, usr/lib/libGL.so.1.0.8762.

Final thoughts

It's hard to recall every step I took to get my eye-candy running, but I hope I covered all the steps above. If you run into any problems, post a response and I'll try to address it as best I can, assuming I can find the answers. I'm sure others have played with Xgl and Compiz by now, so if you have any tips or corrections, please post them.

Otherwise, enjoy your eye-candy!

Load Disqus comments