March 17, 2011, 9:38 p.m.
posted by lambda
Add Depth to Your Desktop
Drop shadows add a dimension of depth to every window and pop up on your desktop. The 3D effect is truly mesmerizing.
A composite manager program called xcompmgr is available that taps into some of the new features of the Xorg X Window System to create attractive drop shadows for windows, pop ups, menus, and the like. It also gives you the option to make your windows and menus fade in and out instead of the normal behavior of appearing and disappearing instantly.
You can use xcompmgr only if you use the Xorg fork of the XFree86 project. You cannot use this with any version of XFree86. And you can use it only if you have a recent version of Xorg. Check which X server and version you're using with the following command:
# X -version X Window System Version 6.8.0
If you don't see 6.8.0 or higher as the version, this hack is not for you.
Get the Composite Manager
A composite manager taps into the new Xorg features that allow X11 to blend various on-screen elements in ways XFree86 cannot. For example, it allows you to make a window partially transparent by blending the background into the application foreground. You can find some programs that appear to give you this feature, such as X terminals that look partially transparent. But they aren't tapping into the features of Xorg; they are essentially "faking it" with some clever graphics tricks. Faking it might look good, but the difference is speed. The Xorg composite features exist as part of the X11 engine, so the effects are built-in and render much faster.
You'll need to install the xcompmgr program to take advantage of these features. You probably won't find this program as a normal package in the standard package repositories for your Linux distribution, because it is experimental and can still be very quirky and unstable at this point. A Google search turned up a number of RPM packages for xcompmgr at http://rpm.pbone.net.
If this or any other site doesn't have a ready-made package that installs cleanly on your Linux distribution, you will have to compile it yourself. Because this is experimental code there's no guarantee it will compile on your system. You need to connect to a CVS server to download the source code. So, log in as root, change to a directory where you like to keep local source code, such as /usr/local/src, and run the following commands (you do not need a password, so just press Enter when prompted for one):
# cvs -d :pserver:[email protected]:/cvs/xorg login CVS password: (press Enter) # cvs -d :pserver:[email protected]:/cvs/xapps co xcompmgr # cd xcompmgr # sh autogen.sh # ./configure # make # make install
Start Your Desktop or Window Manager
The xcompmgr program doesn't play well with every desktop or window manager. In my experience, it does not work well with Metacity, the default window manager for GNOME. Metacity is supposed to have some of the xcompmgr capabilities already built-in, but I have not been able to tap into them. Regardless, you can't invoke xcompmgr until you have started your favorite desktop or window manager, so do that now.
The manpage for xcompmgr explains the various tricks you can do with the program. However, the following combination of command-line switches should please nearly everyone. Open an X terminal and type this command:
$ xcompmgr -cCfF -l 0 -t 0 -r 5 -o .6 &
If everything works the way it should, the screen should go mostly blank for a moment, after which any open windows will reappear with drop shadows. You should also notice that things such as menus have drop shadows and fade in and out. See Figure for an example of this effect.
Firefox and menu with shadows
Here's what the command-line switches do. The -l 0 and -t 0 switches tell xcompmgr that pixels (no shadow at all) should appear to the left of the window (-l 0), and no shadow pixels should appear above the top of the window (-t 0). This means you will see drop shadows only to the right of and beneath the windows, as though the light source is up and to the left. Normally, xcompmgr creates a shadow around the entire window. This effect isn't too bad, but because many other things that appear on-screen (such as your mouse pointer) have shadows to the right and below, this combination makes the simulated light source consistent.
The -r 5 and -o .6 switches tell xcompmgr to give the shadows a radius of 5 and an opacity of 0.6, which makes the shadows somewhat subtle.
Finally, let's pick apart the combination -cCfF. The c tells xcompmgr to include shadows and translucency; the C tells xcompmgr to try to avoid creating shadows for things such as launch panels. The combination fF tells xcompmgr to fade just about everything in and out whenever windows, menus, or other objects change (maximize, minimize, etc.).