Running a basic, truly minimal window manager can save significant CPU cycles and memory. This becomes important if you’re running old, limited hardware or when designing a desktop environment for an embedded Linux device. Even the oldest, most primitive window managers (think TWM or MWM) can support a pretty desktop background image. The ability is almost as old as X itself.

The tool you need is a very old, very small utility called xli. It’s included as part of X.org in many distributions. If your favorite distro doesn’t include it the source code can be found here. You can load the image of your choice either from the command line or when your window manager starts. The command you’d use to add a background to an X session that’s already running is:

xli -onroot <path-to-image>

If you want have this image load when your window manager starts there are two approaches you might use. Some very lightweight but recent window managers have some sort of configuration file which allows for commands to be executed at startup. For example JWM (Joe’s Window Manager) has am xml configuration file which, in a default installation, can be found at

/usr/etc/system.jwmrc

This file uses xli to load a background image, albeit one that probably doesn’t exist on your system, as part of it’s default configuration. In the case of JWM you simply change the default image file. For other window managers you would likely have to specify the command above as one of your startup commands.

Even If your window manager of choice doesn’t have it’s own configuration file it is almost certainly started from a file called .xinitrc. You can have an .xinitrc file for an individual user in their home directory or you can modify the system default file located in /etc/X11 in most current distributions.

TWM, a part of X.org, is the “failsafe” window manager for many distributions. The command to start it in your system .xinitrc looks something like this:

/usr/X11R6/bin/twm &
/usr/X11R6/bin/xclock -geometry 50x50-1+1 &
exec /usr/X11R6/bin/xterm -geometry 80x66+0+0 -name login

That launches twm with an xterm window and a clock. Adding another & and the xli command above will cause TWM to launch with a background of your choice. This method should work with almost any minimalist window manager.

Compiling xli from source

If your distro doesn’t include xli you’ll be compiling from source. Since xli is a really, truly ancient utility compiling it is a bit quirky. When you download xli to your home directory create a working directory below that. Move the gzipped tarball into the newly created directory before you unzip and untar. If you don’t do that the source files (lots of them) will go directly into your home directory.

Next you need to edit rlelib.c. Near the top you’ll find this line:

#include <varargs.h>

varargs.h is no longer supported by gcc. You’ll need to change that line to:

#include <stdarg.h>

Once that’s done you can create your makefile with the command:

xmkmf

The rest (run as root) is what you’d expect:

make
make install

That’s all there is to it. Now even the most primitive window manager can look pretty on your system.