Linux

Getting desktop effects working in Compiz/Emerald

For years Jack Wallen has been a Linux purist -- sticking with Enlightenment, Afterstep, or Fluxbox. But lately he has been itching to get a bit more dimension to his desktop. Jack explains how he managed to get KDE 3.5, Compiz, and Emerald up and running together to create an amazingly beautiful desktop that still retains full functionality, speed, and reliability.

As many of you know my favorite desktop is Enlightenment. But every now and then I want to migrate over to something with a bit more oomph. This time around I wanted to give KDE 4.1 a try...but the powers that be didn't seem to want KDE 4.1 to work out too easily. For that I will wait until it is supported in Synaptic. So I decided I would see how far I could push the combination of KDE 3.5, Compiz, and Emerald. Turns out you can actually push it pretty far without it ever pushing back. But getting to that point was rather tricky.

My system isn't all too impressive:

  • AMD Sempron 3000 processor
  • NVidia Geforce 6600 Video Card
  • 774568k RAM
  • Ubuntu 7.10
  • kernel 2.6.22-14-generic
  • KDE 3.5

That's about all that is relevant.

I already had both Compiz and Emerald installed but neither were working. I also had the nvidia-kernel-common installed. I could run KDE and get the standard KDE elements but none of the 3D elements of Compiz. And when I attempted to enable Compiz, it would start and seem to run but the Window manager (Emerald) was not able to start. It should be pretty obvious what a desktop without a window manager is -- useless. You can't manipulate windows in any way.

My first clue came when I went to find out if direct rendering was supported. Trying to run the glxinfo command came up with nothing. So I realized that glx wasn't installed. So I installed nvidia-glx (which added a number of dependencies). Now I could run glxinfo | grep direct but still saw that direct rendering was giving me a big NO. Of course it finally came down to the fact that the real "nvidia" driver has direct rendering built in, so glx doesn't have to handle the direct rendering. But xgl on the other hand must be used. So I had to install xgl with the command apt-get install xserver-xgl.

Once xgl was installed, I had to make sure the system initialized it. So in the file /etc/X11/Xsession.options I added the entry use-xgl to the bottom.

The next step was to add a new file to the Xsession.d directory. This file is called 91xgl and serves to actually start xgl. Here is the file content:

# This file is sourced by Xsession(5), not executed.

STARTXGL=

XGL="/usr/bin/Xgl"

XGL_OPTIONS=":1 -fullscreen -ac -accel xv:pbuffer -accel glx:pbuffer"

if grep -qs ^use-xgl "$OPTIONFILE"; then

if [ -x "$XGL" ]; then

STARTXGL=yes

fi

if [ -r /tmp/.X1-lock ]; then

xglpid=`cat /tmp/.X1-lock`

if [ -d /proc/$xglpid ]; then

echo "Xgl already running"

STARTXGL=

fi

fi

fi

if [ -n "$STARTXGL" ]; then

$XGL $XGL_OPTIONS &

DISPLAY=:1

fi

# vim:set ai et sts=2 sw=2 tw=80:

The final step was to tweak the /etc/X11/xorg.conf file. These tweaks were simple. First make sure the following are in the section "Module":

Load "GLcore"

Load "glx"

Load "dri"

Note: You may not need the "dri" line if you are using the latest "nvidia" driver because it handles dri on its own.

Finally, in your "Device" section (where you define your graphics card), make sure the following exists:

Option "RenderAccel" "true"

Option "AllowGLXWithComposite" "true"

Now once I logged out and logged back in the first thing I noticed was the KDE started up in half the time. And going into the Compiz settings, every time I checked a feature it automatically appeared.

The next step was to select an Emerald theme. Once I fired up the emerald-theme-manager, I selected one of them but nothing happened. It wasn't until I logged out and logged back in that I was able to see the new theme applied in all of it's 3D beauty.

Now the Cube and the Skydome work. The Emerald themes are beautiful and the animated effects work perfectly. And all of this without taking any noticeable hit on the system.

Naturally I wouldn't apply this to a server system. This is purely a desktop feature. But it is fun. How long will I use it? Who knows -- probably a week or so before I go back to Enlightenment. But I have to say the Compiz/Emerald combo is one heck of a pretty desktop.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

0 comments