How to customise your Linux desktop: Openbox

One step below the desktop environments I have looked at so far in this series are window managers such as Openbox, Enlightenment, i3, and Fluxbox. Configuration is crucial if you want to use one of these instead of a full-featured desktop environment.
Written by J.A. Watson, Contributor

In six previous posts I have looked at a variety of Linux Desktop Environments: Xfce, KDE, Gnome 3, Cinnamon, MATE, and LXDE. Now I am going to move one step lower in the GUI hierarchy, and look at using only a simple Window Manager for your Linux GUI. But in order to do that, I am going to have to spend a minute explaining the difference between the two.

A desktop environment is a collection of programs, tools, and utilities which provides the complete graphical user interface (GUI) to a computer operating system -- in our case to Linux. It is responsible for displaying and managing the screen background (wallpaper), the panels and docks which may be arranged around the edges of the screen, and the various types of windows which may be created and deleted dynamically during the course of normal work.

It is not really necessary to have a complete desktop environment when working on Linux. In the interest of simplicity, or performance, or even personal preference, it is possible to do away with the wallpaper, panels, docks, utilities, and applications. What is still needed even in the most basic environment is something to take responsibility for displaying windows -- opening, closing, moving, decorating, and other such management operations.

The program which provides these functions is called a window manager, and although it is frequently a part of the complete desktop environments, many window managers can be used standalone as well. A good window manager needs to be very configurable, because when you opt for a such a standalone environment, you are likely to want to add back at least a few of the pieces that you gave up from the complete desktop environments.

There are a lot of window managers available for Linux/X Window System installation. The Wikipedia comparison of X window managers lists at least 36 of them, for example. To start this discussion I will be looking at Openbox, because it is well known, widespread, and relatively easy to install. For these tests and screen shots I am using an Acer Aspire One 725, on which I have previously loaded Debian GNU/Linux with Xfce.

To add Openbox to this system I simply went into synaptic and selected 'openbox' for installation, synaptic took care of installing the necessary dependencies.


Openbox default screen

After installing openbox, I logged out of the Xfce desktop, and then on the lightdm login screen at the top right corner, I selected an openbox session rather than Xfce. I then logged in, which was amazingly fast (something like 1 or 2 seconds), but the screen that I got looked like this screenshot on the right.

That's right: blank. Nada. Nothing. Move the mouse around to all of the screen edges and corners, nothing. This is the normal initial state for a window-manager only installation.

The window manager is responsible for managing windows, and nothing else. There are no windows to display or manage yet, because I just logged in, so the screen is blank. There is no wallpaper, because that isn't the window managers job. If you want it to do anything else, like wallpaper, panels, docks or whatever, you have to configure/customize it.

If your poking and prodding looking for some result or response eventually leads you to right-click, you will get the default openbox menu, which looks like this. Again, very simple: no decoration, extra border, handles, controls or whatever. There's not a lot you can do here that is useful, but at least there are a few things... more than just a blank screen.


Terminal Emulator and Web Browser are pretty obvious; Desktops lets you select any of the four predefined virtual desktops (trust me, they are all just as empty as this one), ObConf I will come back to in just a minute, Reconfigure and Restart are the way you tell the openbox window manager that something has changed, it needs to either reread config files or just exit and restart itself. Exit is the way that you logout.

So the one that is interesting is ObConf, that starts the Openbox Configuration Manager, shown here. This is 'configuration central' for openbox, There are eight tabs, each containing a different set of configuration parameters:

  • Theme: Choose colors and highlights for window borders and menus. (Boring)
  • Appearance: Specify the content and order of window title bar controls. The idea here is that the Title is always centered in the title bar, and it automatically expands to push whatever is placed on either side of it to the ends of the title bar. Each possible item is represented by one letter, so the default is 'NLIMC', which places the window icon at the left end, and the iconify, maximize and close buttons at the right end. If you prefer the Ubuntu approach of having all the buttons at the left side, specify IMCL. If you like the 'shutter roll-up' function, add 'S' to the mix. Shutter can be a convenient way to minimize a window without actually losing it off the display and having to use Alt-Tab to recover it.
  • Windows: Specify placement and focus of new windows, and how multiple displays are handled.
  • Move & Resize: Behavior such as whether to (try to) maintain the window contents while moving, and whether to dynamically display size information while resizing.
  • Mouse: How to handle window focus transfer with mouse movement, and what action to take when the title bar is double-clicked.
  • Desktops: Specify the number and name of virtual desktops, and behavior on switching.
  • Margins: If you want to reserve a few pixels around the edge of the screen so you can always reach the desktop background. This can be useful if you don't have panels or docks, and the background is the only way to get to a window manager menu.
  • Dock: Where to place and how to handle a dock. Note that this does not create a dock (or panel, or whatever), that still has to be done by another application, but if/when such an application is running, this specifies how openbox will interact with it.

That covers all of the possibilities for customizing the look and feel of openbox. But there are still some important things missing from the desktop -- like a way to start an application! So let's take a look at that.


If your openbox menu looks exactly like the one shown above, then you still don't have any kind of application menu. If you are running Debian, or a derivative of Debian, you can solve this problem pretty easily by installing the menu package, either through synaptic or apt-get. After that is installed, go back to the openbox menu and either Restart or Exit (logout/login). The openbox menu will then contain a new item called Debian which is a categorized/cascading menu of standard Debian applications and functions.


This menu item is important because it is where you are going to find all of your normal applications and utilities. It is organized as a typical category/cascading menu, so walking through all of the various sub-menus you should be able to find all of the available programs, utilities and applications.

So now, in addition to being able to start a terminal window or a web browser directly from the top level openbox menu, you have a way to start most other utilities and applications, as well.

At this point we still have no panel or dock on the desktop, but whatever applications are started will have window decorations with a title bar and the usual Iconfiy/Maximize/Close buttons. That means that if you start something, and then click Iconfiy (Minimize) on the title bar, it will disappear from the screen without a trace. Don't forget that Atl-Tab still works at this point. (Does this sound like the voice of experience talking?)


If you want to customize the openbox menu, you need to install another package. Go back to synaptic or apt-get and install 'obmenu', then run that from a terminal command line. That will bring up this window, which shows the content and structure of your menus. (For those who are more Linux-knowledgeable, this is read from ~/.config/openbox/menu.xml if it exists, otherwise /etc/xdg/openbox/menu.xml)

This is not likely to go down in the annals of history as one of the most user-friendly utilities ever, but if you look at it closely you can see how it relates to the structure and content of the menu above. You can add/modify/delete and change the order of menu items here.


If you look at the /Debian line, you will see that it is listed as a Link. That means it uses the content from another menu file, in this case /var/lib/openbox/debian-menu.xml. To edit that menu click File/Open, and then navigate to the path shown here, or simply invoke it as obmenu /var/lib/openbox/debian-menu.xml.

You can add/change/move/delete menu items here as well, and then save the modified xml file and restart openbox to pick up the changes. If you look carefully here you can see that I have added an item for the shutter program.

OK, that's all good, and if minimum resource use and desktop clutter is your highest priority, then we have reached a point where openbox is usable. But honestly, I don't know very many people who would be satisfied with it at this point, so we need to add a few more things.

One of the best and most productive would be some kind of Panel where we could have a menu, some launchers, controls and such. If you look at the Openbox Help topic about Panels you will find a list of 30 or so different packages.


One of the simplest of these is fbpanel, which can be installed using synaptic or apt-get. Once that is complete, you have to add it to the openbox startup file, which is in ~/.config/openbox/autostart, with a simple background command like "fbpanl &". When that is done, and you logout and login again, you get a screen with a bottom panel! Yay, that's a lot nicer.


This bottom panel has a Debian menu at the left end, some application launchers, a 'show desktop' icon, a taskbar which will have icons for each running window, a virtual desktop selector and a group of controls, monitors and a clock at the right end. This looks like a much more comfortable desktop to use than the bare-bones openbox was.


The Debian menu at the left end of this Panel is once again a typical category/cascade menu, and in the last category, Computer, you will find the lock/logout/reboot/shutdown options.

Of course there are other choices of panels that could be used. In addition to other stand-alone panels you can also use the panels from the common desktops - LXDE, Xfce, KDE or Gnome - and in fact, LXDE actually uses openbox as its window manager.

As I mentioned at the beginning, the system I am using for this post was running Xfce, so it already has the Xfce panel installed, and all I have to do is edit the Openbox autostart file, and change the fbpanel entry to "xfce4-panel &". Then logout and login again, and the desktop looks like this.


Hey, cool! Not only does it have Xfce Panels now, but they are configured exactly as I had set them up when running Xfce on this system. A small bottom Panel with applications launchers, a spanning top Panel with the menu and controls...

I guess that makes sense... xfce4-panel has its own configuration file that it reads, so it's going to end up looking the same. Duh.

That's important to remember, though, if you decide to make changes to the panels. If you're "sharing" panels between openbox and Xfce, and you make a change such as removing a launcher or icon from the panel when running openbox, then the next time to login to an Xfce session you will see that the change has been made there, as well.

I just realized that there is one topic that I have not covered yet - wallpaper. I made a big deal out of this with all of the desktops, so to be fair I should do the same here.

It probably won't come as news that to manage the desktop wallpaper in openbox you have to... wait for it... install another program! Just as you had to for menu management, and panels, and pretty much anything else you want to add on. This time it is the nitrogen package that you need to install, either using synaptic or apt-get.

Once you get nitrogen installed, you're pretty much done. It's really that trivial. You can run it from the command line in a terminal emulator, and you give it the path to wherever the image files you want to use for wallpaper are located. On Debian this is simply

nitrogen /usr/share/wallpapers


Nitrogen will search the directory hierarchy starting at the point specified on the command line, and then will present you with a list of images that it finds which could be used for wallpaper. All you need to do then is select one and click 'apply'. The are options under 'automatic' at the bottom left corner of the screen to control how the image is adjusted or manipulated if the image size doesn't match the screen size.

The wallpaper set in this way will only be effective for the current session -- until you logout, shutdown or reboot. The next time you login it has to be set again, but fortunately nitrogen helps with that too. All you need to do is add a line to your autostart file:

nitrogen --restore &

This will set the wallpaper to whatever it was the last time nitrogen was run.

I think that's enough to provide a good start on configuring the openbox window manager. We have seen how it differs from the complete desktop systems that I have previously discussed. By default it provides an absolute minimum functionality, just decorating and managing windows and providing a menu for launching programs. The beauty of openbox is that on top of that minimum functionality you can add just the bits that you want/need to get the desktop environment you choose, at a price in performance and resources that you are willing to accept.

This approach is not for everyone, that's for sure. Most people are likely to be happy with one of the predefined desktop environments. But advanced users who want to extensively tailor their desktop, either to fit their own needs or the hardware it is running on, will find openbox to be a very powerful tool.

Read more on Linux and open source:

Editorial standards