Translation(s): English - Español - Français - Italiano - Русский -简体中文


Some information on the Openbox window manager.

Introduction

To understand what Openbox actually is, it's important to know the difference between a window manager and a desktop environment.

A window manager is the program which draws on your screen the "box" in which the program is run. A window manager controls how your program window works, looks and acts. It decides what window decorations to use and gives you a way to move the windows, hide them, resize them, minimize them and close them. It controls what buttons you push to do those things, and what keys you press to make those things happen.

On the other hand, a desktop environment minds the entire desktop. It provides a taskbar, a system tray, a login manager, additional menus or perhaps screensavers and desktop icons. It might include a file manager, a text editor or some other accessory programs, too.

Openbox is a window manager, not a desktop environment. Openbox is only responsible for maintaining the windows you open on your screen -- nothing else. That means installing Openbox won't give you easy menu access to wallpaper options, a taskbar or system panel, or most of those other doo-dads. It does, however, give you a framework to incorporate other programs that do those things -- and usually with a greater degree of freedom over the style and interface.

Openbox can be used alone, without a desktop environment, or it can be used to replace the window manager in a complete desktop environment. Either way is acceptable.

Installation

The easiest way to install Openbox on a Debian system is using the Advanced Packaging Tool (APT). Therefore, become root and enter the following command at the commandline prompt:

# apt-get install openbox

Normally, a right-click desktop menu will automatically be generated for you on installation.

If, however, your desktop menu is not being auto-generated with DebianMenu, you will have to install the menu package:

# apt-get install menu

Running Openbox

From login manager

To start an Openbox session from KDM or GDM, simply choose 'openbox' from the session or session-type menu.

To run Openbox from XDM you should setup a .xsession file in your home directory and add the following line to it:

$ exec openbox-session

Alternatively there is the possibility to use the Debian alternatives (see ?update-alternatives) and setup x-session-manager to be Openbox.

From commandline

To run Openbox from the commandline login, setup the .xinitrc file in your home directory and insert the following line:

$ exec openbox-session

Alternatively there is the possibility to use the Debian alternatives (see ?update-alternatives) and setup x-window-manager to be Openbox.

Note: You don't have to set things up like this if you are using pure Openbox. Just run startx.

Basic configuration

Obconf

ObConf is a small graphical utility which configures Openbox's preferences and configuration settings on the fly.

If you are an Openbox user, you want this package.

# apt-get install obconf

Obmenu

Obmenu is used to configure Openbox menus. It is a graphical alternative to directly editing one's menu.xml file.

# apt-get install obmenu

Wallpapers

As Openbox itself is not capable of managing desktop wallpapers, you will have to use an additional program to set your background image. There are several applications available for that kind of job (see Alternatives section below). The most common is a small lightweight image viewer called feh.

Setting your background image with feh

feh is an imlib2-based image viewer with a number of features, but perhaps the most popular is the ability to draw desktop backgrounds.

The program can be installed via APT with the following command:

# apt-get install feh

Now, pick a wallpaper and try this command in a terminal:

feh --bg-scale /path/to/your/background/image.jpg

Note: Apart from JPEG, feh can also handle a variety of other image file types, including PNG, TIFF and GIF.

Once you have chosen a wallpaper, feh stores its name in a file called .fehbg. That means you can tell it to restore the wallpaper on the next boot by checking that file. Add the following to the autostart.sh file in /etc/xdg/openbox.

#My wallpaper
eval `cat $HOME/.fehbg` &

Random wallpaper

One neat trick available with feh is a random wallpaper on each boot. Create a directory in your home folder called "wallpapers" and put a few background images into it. Then copy the code below into a file called wallpaper.sh and save it anywhere. A good place is ~/.config/openbox

 #!/bin/env bash
 WALLPAPERS="/home/yourUserName/wallpapers"
 ALIST=( `ls -w1 $WALLPAPERS` )
 RANGE=${#ALIST[@]}
 let "number = $RANDOM"
 let LASTNUM="`cat $WALLPAPERS/.last` + $number"
 let "number = $LASTNUM % $RANGE"
 echo $number > $WALLPAPERS/.last

 feh --bg-scale $WALLPAPERS/${ALIST[$number]}

Next, make the script executable.

chmod +x wallpaper.sh

Now add that program to the autostart.sh file, like this.

#Random wallpaper
./pathFromHome/wallpaper.sh

When you log in, the script should be executed, and feh should pick a new wallpaper.

Alternatives

feh isn't the only program that can handle drawing background images. Here are some others:

Additionally, some file managers have the ability of managing your wallpaper, for example:

Screensavers

If you're building an Openbox desktop with Gnome already installed, you'll probably already have gnome-screensaver in place. Pure Openbox fans might want to install xscreensaver, which is more customizable and has a wider variety of screensavers involved.

Without Gnome or KDE in place, installing xscreensaver needs a couple of extra commands:

# mkdir /usr/share/backgrounds
# apt-get install xscreensaver xscreensaver-gl

The first command sets up a default directory that xscreensaver will look for when it runs. If you don't create that directory, you'll get a string of error messages the first time you set the preferences.

The second command installs xscreensaver and its optional files.

Now add this command to Openbox' autostart.sh file in /etc/xdg/openbox to start the xscreensaver daemon on boot.

xscreensaver -no-splash &

You can access the xscreensaver preferences panel by running xscreensaver-demo from the Openbox menu or from a terminal window.

Desktop icons

iDesk

You can add customizable, clickable icons to your desktop with iDesk.

# apt-get install idesk

Consult the iDesk wiki for instructions on how to configure and use iDesk. For icon sets, you may wish to search the repositories, or download them from third-party customization sites, such as Gnome-Look.org and similar locations.

Rox-Filer

Rox-filer is a file manager, but in addition to handling wallpaper, it also has a pinboard option, and can manage desktop icons. Install rox-filer with this command:

# apt-get install rox-filer

You can set up the pinboard through Rox's menus.

GTK themes

Program GUIs might look ugly if you're working on a pure Openbox system. Install gtk-theme-switch and the gtk2-engines package to give yourself a few more appealing options.

# apt-get install gtk-theme-switch gtk2-engines

Bring up the configuration menu with this command, from a terminal or the Openbox right-click menu.

# gtk-theme-switch2

Be sure to search the repositories for other engines that aren't included in the gtk2-engines package.

You can also try installing a Gnome package that will manage some of the settings for you.

# apt-get install gnome-settings-daemon

If you prefere an Xfce look, try

# apt-get install xfce-mcs-manager

Both of those programs can be added to your Openbox menu, or started from a terminal.

Keyboard shortcuts

Openbox default key combinations

Configuring key bindings

Keybinding configuration is done manually by editing your rc.xml file, normally found in the ~/.config/openbox directory. Full documentation is available at the project's website.

Additional software

File managers

Name

Description

Beesoft Commander

Configurable, more or less orthodox Linux file manager

gentoo

Nautilus

GNOME graphical desktop shell (capable of managing wallpapers and desktop icons)

PCManFM

A fast and lightweight file manager that can draw wallpapers and desktop icons

ROX-Filer

Thunar

The fast and lightweight file manager from Xfce

Xfe

Small, fast and desktop-independent file manager based on X Win Commander

Taskbars and pagers

Some people prefer to use a taskbar or pager to keep track of running programs. Here's a list of applications you can add to your Openbox installation that will handle that task for you.

System monitors

If you're looking for a way to display system information, try these nifty programs.

If you're working on Openbox in conjunction with a Gnome installation, you might also look into gdesklets, which features some very polished monitors and meters for desktop display.

Miscellaneous

See Also