Openbox - Customize your Window Themes



by Paul Arnote (parnote)

One nice thing about many of the Linux desktop environments and window managers is the ability to customize the appearance of your desktop. This doesn’t mean only wallpaper. This also includes window appearance. Openbox is no different in this aspect. Additionally, the information in this article applies equally to LXDE, since it uses Openbox as its window manager.

While it’s possible to create your own Openbox theme from scratch by hand (obviously, since someone had to have created the first Openbox theme), you will find it easier to find a theme that you like and modify it to suit your individual tastes. The latter is the path we’ll take with this article. Typically, you install and change your Openbox themes through the OBConf utility. However, you can also manually install them, provided you place them in the proper location. You can find many ready-to-go Openbox themes from other Openbox users.

If you choose to modify one of your favorite themes, I strongly urge you to make a copy of the theme and make your modifications to the copy. This way, if you royally screw up the modification, the original remains unaltered and intact.

To get started, it’s important to know where Openbox themes are stored. Your themes can by “system-wide” themes (accessible to all users on a computer) or user-specific themes (accessible to only that particular user). System-wide themes are stored in /usr/share/themes, and you will need root access to make modifications. User-specific themes are stored in either ~/.local/themes or ~/.themes. The advantage to these themes is that you can modify them without having root access. The disadvantage is that they are available only to one particular user, unless you copy the theme to /usr/share/themes for all users to access. To do the latter, you will need root access. I tend to use the user-specific location, and if I come up with something that I like, I can then move them to the folder for system-wide themes, sharing my new theme with all the users on my computer.

Much of what controls the appearance of a theme in Openbox is stored in an X resource database file, called themerc. It’s no more than a specially formatted text file. Typically, this file is stored in the themes folder, which takes on the form of another folder with the name of the theme, containing another folder named openbox-3. So, the “Appleish” themerc file, the theme upon which I based my modifications off of, is stored in /usr/share/themes/Appleish/openbox-3. The other files in the folder are the graphics files that form the window decorations.

Most likely a byproduct of its light weight, the choice of graphics format used to create the window decorations in Openbox imposes some inherent limitations. The graphics have to be in the *.xbm format, which is a binary color format. In case that’s not striking you just right, let me put it this way: you can use any colors you want, so long as they are black or white. Essentially, the *.xbm file acts like a mask on the window title bar, and the instructions in the themerc file tell Openbox how to paint that mask and with what color. Face it: there aren’t a lot of things you can do with a binary color graphic file format.

Below is a collection of all the graphic files in the Appleish theme, with labels:

Pretty plain, huh? As you might already be able to tell, there aren’t a lot of options, and this somewhat restricts what you can do in an Openbox theme. Conversely, xfwm (the window manager for Xfce) allows the use of *.xpm files. Xpm files allow the use of color, giving you many, many more options in the appearance of your window decorations.

Below is the unaltered Appleish Openbox theme, showing an active and inactive window:

In the above image, I held the cursor over the exit button on the window title bar (putting the window decoration into the “hover” state), so you can see how the image is painted by the themerc file.

Below is my altered version of Appleish:

Again, I held the cursor over the close button of the active window (“hovered”) so you can see how the themerc file has been altered to paint the window decorations in the customized version. Notice how the close button is now painted yellow (I can’t help myself, since yellow has always been my favorite color), instead of dark gray.

Other differences you might notice include a darkening of the window titlebar, a change of the active titlebar font color to white, and the inclusion of the “raised” drawing flag for the window titlebar. In the altered Appleish theme, I left the inactive window settings unchanged from the original.

Remember that all of the painting of the window titlebars, the titlebar fonts, and the colors to use for many other settings, are under the control of the themerc file for the particular theme you are using. Although colors can be expressed as names of colors (as recognized by Xorg) and RGB:xx:xx:xx format, the most common format for specifying colors is the six digit hexidecimal color notation that most associate with how you express colors in an HTML file. Black becomes #000000, bright red is #ff0000, bright green is #00ff00, bright blue is #0000ff, and white is #ffffff. Other colors can be created by creating combinations of the three color intensities. Just be sure to keep each digit in the range of 0 to F.

Fortunately, all of the available options for the the themerc file are documented fully and extremely well in the Openbox Wiki. Instead of trying to cover them here, I’m going to refer you to this excellent resource instead. They have already done an outstanding job of explaining all the relevant information there.

Summary

A quick, cursory look at a themerc file may be enough to scare some users away from customizing their Openbox themes. But given the fact that the themerc file is little more than a specially formatted text file, and the additional fact that the themerc file options are so well documented, you owe it to yourself to at least give it a try.

Granted, while my first attempts at modifying my Appleish theme were quite horrendous in appearance, I quickly got a handle on what I needed to do and ended up making a theme modification that is uniquely mine, and one that suits me even more than the original Appleish theme.