February 2, 2006

Openbox: A lightweight window manager

Author: Mayank Sharma

Most Linux-based distributions for the masses have either GNOME, KDE, or both desktops, yet the startup times and resources required by both GNOME and KDE make them unsuitable for old or lower-end hardware. My quest for a standards-compliant, fast, lightweight, and extensible window manager led me to Openbox.

Openbox complies with both the Inter-Client Communication Conventions Manual (ICCCM) and the Extended Window Manager Hints (EWMH). Originally derived from Blackbox, Openbox version 3 was completely rewritten in C. Among its fancy features, it supports chainable key bindings, customizable mouse actions, and multi-head Xinerama.

Unlike GNOME or KDE, Openbox as a window manager is a drawing board; you have to add your own desktop icons and panels. It's not as difficult as it sounds, and it gives you the freedom to design your own desktop.

Installing and configuring

Compiling Openbox from source is simple, and RPM and .deb binaries are also available. For instance, under Ubuntu, if you have the Universe repository, the command apt-get install openbox obconf openbox-themes will get you Openbox, its configuration editor, and some themes.

Openbox can be used as a replacement to GNOME's and KDE's window managers or as a standalone GUI. If you are running GNOME, openbox --replace will replace Metacity. If you save the session on exit, Openbox will become your default window manager. KDE users who want to replace KWin need to set up an environment variable by adding the line export KDEWM=openbox in .xsession or .xinitrc.

Openbox has two configuration files: menu.xml and rc.xml. Their user-specific versions are found under $HOME/.config/openbox/. System-wide files are under /etc/xdg/openbox if Openbox was installed from a distribution package, or under /usr/local/etc/xdg/openbox if compiled without the --sysconfdir switch. Openbox looks for files in the home directory first. If you want to change the appearance, behavior, and dock preferences of Openbox, you can use ObConf or edit the configuration files in a text editor.

Click to enlarge

It's also easy to configure mouse and keyboard bindings. You can, for instance, make windows change desktops when you click the close button with the middle mouse button, or bring up the right-click menu with a key combination to minimize mouse usage. You can also emulate Metacity's Alt-Tab binding that lists all open windows, or bring up the run application window with Alt-F2 and cycle through the desktops, with minor modifications to the rc.xml configuration file.

Running standalone

Although some users prefer running Openbox on top of GNOME or KDE, others extend it with additional small programs that add icons, taskbars, launchers, or other eye candy. I installed PerlPanel, a lightweight panel that supports applets and works well with Openbox, along with the ROX-Filer file manager. If you prefer a more Mac-like experience, try Kooldock for a Mac OS X-like dock or iDesk to get cool desktop icons.

To generate menu entries for Openbox, try MenuMaker, which you can use without installing by running the command:

mmaker OpenBox3

This creates menu.xml under ~/.config/openbox. Edit it as per your needs. It looks like:

<?xml version="1.0" encoding="UTF-8"?>
        <menu id="root-menu" label="OpenBox 3">
                <menu id="2" label="Editors">
                        <item label="OpenOffice.org 2.0 Writer"> <action name="Execute">
                                <execute>openoffice.org-2.0 -writer</execute>
                        </action> </item>
                        <item label="Text Editor"> <action name="Execute">
                        </action> </item>
                        <item label="Vim"> <action name="Execute">
                                <execute>xterm -e vim</execute>
                        </action> </item>
                <menu id="18" label="Games">
                        <menu id="10" label="Arcade">
                                <item label="Frozen-Bubble"> <action name="Execute">
                                </action> </item>
                        <menu id="11" label="Board">
                                <item label="3D Chess"> <action name="Execute">
                                </action> </item>
                                <item label="Shisen-Sho"> <action name="Execute">
                                </action> </item>

To make programs and scripts run at startup, you must place them in your ~/.xsessions file. If it doesn't exist, create it by copying the lines below and saving it as .xsessions. If you use startx to boot into a GUI, edit ~/.xinitrc to place the following lines in it:

# Startup stuff for X

# Start the panel
perlpanel &

# Start the file manager
rox-filer &

# If you'd like Rox-Filer to display icons on your desktop
rox-filer --pinboard=PIN &

# Put the background image using ImageMagick
display -dispose Background -window root /home/user/desktop.jpg

# Start the volume manager to automount external volumes
gnome-volume-manager &

# Start the screensaver
xscreensaver -no-splash &

# Start Openbox
exec openbox

Next time you log in, select the Default or Custom option from your display manager to log in to your shiny new desktop.


Openbox is a super-fast standards-compliant window manager with a small memory footprint, which saves valuable amounts of RAM for more useful tasks, especially on low-end or dated systems. It is easy to use and extend, even for a new user.

Click Here!