My blog has been moved to ariya.ofilabs.com.

Tuesday, January 24, 2006

Translucency and Shadows Made Easy

When I show my desktop with real translucency and window shadows, I am often asked how to do that. It's been ages since KDE is able doing this effect, yet not so many people are aware of it. So here I rehash the instructions in few steps (but remember: YMMV). In short: use KDE 3.4 or higher with the composite manager.


Translucency for the desktop, click to enlarge

First step is to get accelerated driver for your X. This is not always necessary but often you get smoother performance. Beside, it's good to install it even if you don't need playing with eye candy anyway.

Next is to get the composite manager. Somehow I manage to make translucency and drop shadows only using the X Composite Manager from X.Org. The easiest way is to install the binary package. This step is distribution-specific. On SUSE, just launch yast to install additional software, search for xcompmgr and finish it with few mouse clicks.

Update (thanks to anonymous): you do not need this xcompmgr with KDE because KDE has its own composite manager already (kompmgr).

Now you have enable the composite in X. For X.Org version (like what is used in major Linux distributions), edit /etc/X11/xorg.conf. Please make a backup first, in case you screw your system. In this config file, make sure you have these lines:

Section "Extensions"
    Option "Composite" "true"
EndSection

After this, check .xinitrc in your home directory, add this:

xcompmgr -c

Log out and then log in again, or just restart your X.

Open a window, right-click on the title bar and choose Configure Window Behavior (you can also use Control Center to reach the dialog but I always find this way faster). Click Translucency on the left pane and the rest is self-explained. You just need to enable the effect and customize the translucency and shadows as you like. For example, you can make the window translucent only when you move it. Or even make every single window translucent. Same goes for the shadow settings.

Compare Konqueror's window without (left) and with (right) shadows:

and you certainly don't want to look back.

17 comments:

Anonymous said...

I had to go back to no transparency, because when somebody send me message in Kopete and the yellow buble showed. X crashed. Do you have the same problems. I am Using KDE 3.5 and X 6.8.2-r6 and have Nvidia binary drivers 1.0.6629-r5
on Gentoo.

jospoortvliet said...

it's way too unstable on many machines to recommend this to users, imho... gives linux/KDE a bad name.

Ariya Hidayat said...

marko: So far I never experienced any crashes.

superstoned: Many use it without problems. Of course, if you can't get it running well then do not show it.

Anonymous said...

On my computer, it works like a charm but only for a few hours. At some point happens a huge memory leak which makes the computer unusable until I turn off transparency.

Xorg 6.9, KDE 3.5 and NVIDIA 5900 Ultra

Anonymous said...

You don't actually need to run xcompmgr, which is just a proof-of-concept composite manager that comes with X.

Having desktop environment native composite managers, like kompmgr which you can enable through "Window Behavior" > "Translucency", is the way to go. With your setup you're running *two* different ones.

Anyway, with that being said I agree that current composite eye candy still isn't quite ready for prime time. I'm using x.org 6.9 plus the latest NVIDIA drivers and just now has the composite extension reached a point where it doesn't crash several on a regular basis. Plus kompmgr is still chock full of bugs that make it unusable for anything other than to show off what the desktop will look like further down the road. For the record I'm using KDE 3.4.2, maybe things have improved dramatically with the composite manager shipped with 3.5, but I'm not holding my breath.

Right now I'd say the major bottleneck in a composite desktop are the composite managers themselves. X and NVIDIA drivers seem to be stable enough for daily use.

Anonymous said...

Ariya, what video card do you use? I have a Radeon 9200SE, and switching desktops took AGES. (As in, nearly a full second.)

Ariya Hidayat said...

liquidat: I can make it work with Radeon 7500, but the speed is not really acceptable.

Matthew Marshall: see above :-) For better experience, ATM NVidia is better

Anonymous said...

Kompmgr comes in KDE 3.5 has an option for 'windeco only' transparency as well.
My desktop is rock solid. (Even I use Oracle 10g/Gimp etc with this settings).
Here it is:
http://kde-look.org/content/show.php?content=33604

Anonymous said...

"see above"

Umm... Where now? I read the post and comments a third time and still don't see it. Am I blind or something??

So, you are saying that the binary NVIDIA drivers are currently better than the OSS drivers in X.Org 7.0/6.9? :-/

Ariya Hidayat said...

Matthew Marshall: "see above" meant "see my comment to liquidat just right before this". Sorry for the confusion

Anonymous: hehe.. I'm about to blog about that Vista look :-) Perhaps tomorrow...

Anonymous said...

Hm, the settings in KDE don't work for me (perhaps a problem with kompmgr). xcompmgr does affect the display, however I get nearly a full shadow over the kicker tooltips in KDE 3.5. In the current stage I wouldn't recommend it to any user whose main interest is to work but to play with his system.

Anonymous said...

OK since it is realy just adding four lines in xorg.conf I tried it and it works pretty good (xorg 7.0 modular including intel810 driver for my Intel GMA 900, KDE 3.5).

I have use shadows + have set translucency for background windows to 40%.

My problem: konqueror also when in the background newer becomes tranlucent - also the translucency slider indicates 40% and I can move the slider manualy to get translucency. All other apps work.

Any ideas?

Regards, seppelrockt

Anonymous said...

Update to the konqueror translucency problem!

IT DOENS'T WORK when I have checked "active window" in the tranclucency tab and set the slider to 100% (meaning no transparency).

IT WORKS when I simply uncheck the "active window" option - that's OK for me cause I want the active window to be solid anyway.

Is this behaviour a bug (since it works as expected for all other apps if tested)?

Anonymous said...

Update to the konqueror translucency problem!

IT DOENS'T WORK when I have checked "active window" in the tranclucency tab and set the slider to 100% (meaning no transparency).

IT WORKS when I simply uncheck the "active window" option - that's OK for me cause I want the active window to be solid anyway.

Is this behaviour a bug (since it works as expected for all other apps if tested)?

Anonymous said...

With 6.8.2 on ubuntu-64 (breezy) and ati proprietary fglrx 8.16.20, I get an unusable X when I enable that extension. Since I use fglrx for GL applications, turning it off is not currently an option. It would be neat if there was a GL based driver we could render into though, since the Composite Extension would fall by the wayside.

Anonymous said...

The major show-stopper for me was that video overlays work really badly with composite enabled. Video and OpenGL windows would be shown on top of everything regardless of whether they were on top or not. Also, if a window below the overlay updated, it would flash briefly on top, which got really annoying.

Anonymous said...

With NVIDIA 81.78 drivers and xorg 6.9.0 the opengl doesn't work, and I can't get no translucent konqueror.