From Gentoo Wiki
Jump to: navigation, search
External resources
IconClipboardTask.png This article has some todo items:

Openbox is a highly configurable, next generation window manager with extensive standards support.


Install x11-wm/openbox:

→ Information about USE flags
USE flag Default Recommended Description
branding No Enable Gentoo specific branding
debug No Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see
imlib No Adds support for imlib, an image loading and rendering library
nls No Adds Native Language Support (using gettext - GNU locale utilities)
python No Install the python xdg files for xdg autostart
session Yes Yes Enables support for session managers
startup-notification Yes Enable application startup event feedback mechanism
static-libs No Build static libraries
root # emerge --ask openbox


There are four files to consider when configuring Openbox:

  • autostart
  • environment
  • menu.xml
  • rc.xml

Openbox installs these files to /etc/xdg/openbox/. If you want to override them, create your own in ~/.config/openbox/.


To start Openbox you can use a display manager or startx.

If want to use startx and want ConsoleKit support, setup ConsoleKit and create the following file:


exec ck-launch-session dbus-launch --sh-syntax --exit-with-session openbox-session


The autostart file is the ideal way to execute specific commands and programs when Openbox starts. It makes no difference if you start Openbox using startx or any display manager. Here is an example:


# Sets the wallpaper to an image of your choice.

# Sets the DESKTOP_ENV variable to "OPENBOX"

# The following are examples on how to call programs; NOTE: unless you call programs in a daemon mode
# like the conky example below you will need to include an ampersand (&) to start the command and fork it to the background.
conky --daemonize

# Waits one second and starts the networkmanager applet.
sleep 1 && nm-applet --sm-disable &

# Starts a light-weight X11 desktop panel.
fbpanel &

# Starts a lightweight image viewer.
feh --bg-scale ~/Artwork/${wallpaper}&

# Starts a simple battery monitor for the system tray.
batti &

# Starts a program that turns on numlock in X (after X starts).
numlockx &


This is the ideal place to export global variables and configure your Openbox environment as appropriate:


eval $(gpg-agent --daemon)
eval $(gnome-keyring-daemon)
if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
       eval `dbus-launch --sh-syntax --exit-with-session`



rc.xml is used to specify keybindings and mousebindings. It is located in /etc/xdg/openbox or ~/.config/openbox.

The following are the modifiers.

Key Description
S Shift key
C Control key
A Alt key
W Super (windows) key
M Meta key
H Hyper key

To make a keybinding, you can combine modifiers and a key. They are separated with the '-' sign.

Case matters. 'S' (uppercase) is the shift key while 's' (lowercase) is the s alphabet key.


Keybinding Modifier
Alt-o A-o
Ctrl-Alt-x C-A-x
Ctrl-Alt-Shift-y C-A-S-y
Shift-s S-s
The keybinding should go between <keyboard> and </keyboard> in rc.xml.

If you want to open xterm with Super-t, you should add the following to the rc.xml:


<keybind key="W-t">
  <action name="Execute">

You can also bind menus. For example, you can bind Openbox right click and middle click menu with the following:


<keybind key="W-x">
  <action name="ShowMenu">

<keybind key="W-z">
  <action name="ShowMenu">

In the above example, the right click menu is bound with Super-x, and the middle click menu is bound with Super-z. It is useful especially if you prefer not to use any panel with Openbox.



Icons in Openbox menu

Since version 3.5.0 you can have icons next to your menu entries. For this:

1) You must emerge openbox with imlib support: Add USE flag imlib for x11-wm/openbox into you /etc/portage/package.use like this:

root # echo "x11-wm/openbox imlib" >> /etc/portage/package.use
root # emerge --ask --changed-use openbox

2) Add <showIcons>yes</showIcons> in the <menu> section of the rc.xml file.

3) Add in menu.xml icon="<path>" like this:


<menu label="Shells" icon="/usr/share/icons/shell.png">
	<item label="xterm" icon="/usr/share/icons/xterm.png"><action name="Execute">

See also