New life, new desktop

With my studies coming to a close and an internship (hopefully leading to permanent employment!) coming up, the times are changing. Some things come to an end, others begin. And to mark the change (and because I was fed up with Xfce), I moved back to an old sweetheart of mine, Openbox. A few bugs that annoyed me have been fixed, it’s ultralight, my terminals have no window decorations, and a little scripting gives my dear xterms the slight translucency that is characteristic of all cool, Composite-powered desktops.

And this is what that looks like.

Getting translucent terminals on Openbox

People have asked me how to do this, so here’s a quick manual on setting up transparent terminals in Openbox, using xcompmgr and transset-df.

First, make sure that you have the Composite X11 extension activated. xdpyinfo | grep Composite should print ‘Composite’. If it doesn’t, refer to google for information on how to enable the composite extension for your video board.

Then, install xcompmgr. If you’re on ubuntu, the package is in universe. In Debian, the package is only in experimental, and you have to build it yourself. Add the following to your /etc/apt/sources.list:

deb-src ftp://ftp.pl.debian.org/debian/ experimental main non-free contrib

You should also comment out all other deb-src sources temporarily. Then:

$ sudo apt-get update
$ apt-get source xcompmgr
$ cd xcompmgr-1.1.1+cvs.20051218
$ fakeroot debian/rules binary
$ dpkg -i ../*.deb

You also need to install transset-df. Ubuntu also has transset in universe, but that is not what you want: transset-df is a fork of transset, and where transset can only apply transparency settings to the window you click on, transset-df can also select the window by window-id. Transset-df is pretty easy to install, just run make && sudo make install in the extracted sources directory.

Now, we have all the components that we need. First things first, we need to get Openbox to start xcompmgr. Put the following in your ~/.config/openbox/autostart.sh:

# Call the systemwide startup script to start Gnome/KDE/DBus services
. $GLOBALAUTOSTART

# Set the wallpaper, and any other stuff you might want here
$BG -full ~/.config/openbox/wallpaper.jpg

# Start xcompmgr
xcompmgr -n &

Check out the xcompmgr manual for more flags. -n tells xcompmgr to do simple client-side compositing: transparency only, no dropshadows or eyecandy fading effects. I like my desktop simple.

Restart openbox (or start xcompmgr manually for this session), and check if the compositing works: run transset-df 0.80 and click on any window when the cursor turns to a targetting reticle. When you click, the targetted window should turn a classy shade of transparent. If it didn’t, there’s something wrong with xcompmgr or your X11 Composite setup.

Now, that’s all very well, but how do we make all terminals transparent? We’re not going to click on each one each time we open it!

The easiest way I’ve found to do this is to edit my .bashrc (replace with the settings script appropriate for your shell), and add the following right at the end:

# Engage transparency if we're running in xterm
if [ "$TERM" = "xterm" ]; then
  sleep 0.1; transset-df -i $WINDOWID 0.75 >/dev/null
fi

The sleep is there to give xterm enough time to actually create the window. Without it I found that on my machine, transset-df would sometimes run before the window was actually created, so it’d end up not being transparent. A 0.1s delay is imperceptible enough to not be annoying, and gives xterm enough time to fire up properly before going transparent.

And there you have it. Of course, now that you have compositing enabled, you can make any window as transparent as you like, but I like to keep it simple and classy, and only have the terminals colored a hyperintelligent shade of transparent.

That is all.