This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
Openbox
Openbox is a highly configurable, next generation, stacking window manager for X11 with extensive standards support. It was originally forked from Blackbox. It is used by the LXDE as its default window manager and KDE can also use Openbox as its window manager instead of its default window manager, KWin.
Installation
USE flags
USE flags for x11-wm/openbox Standards compliant, fast, light-weight, extensible window manager
branding
|
Enable Gentoo specific branding |
debug
|
Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces |
imlib
|
Add support for imlib, an image loading and rendering library |
nls
|
Add Native Language Support (using gettext - GNU locale utilities) |
session
|
Enables support for session managers |
startup-notification
|
Enable application startup event feedback mechanism |
svg
|
Add support for SVG (Scalable Vector Graphics) |
xdg
|
Install the python xdg files for xdg autostart |
Emerge
Emerge Openbox:
root #
emerge --ask x11-wm/openbox
Configuration
There are four important files to consider when configuring Openbox:
Openbox installs these files to /etc/xdg/openbox/ To have Openbox use custom configurations for each user, copy the four configuration files above to the home directory of each user (~/.config/openbox/), then modify each according to the users' needs.
For example:
user $
mkdir -p ~/.config/openbox/
user $
cp /etc/xdg/openbox/* ~/.config/openbox/
Then use a text editor of choice to start making changes:
user $
vim ~/.config/openbox/autostart
Starting
To start Openbox it is possible to use a display manager or the startx command.
To use startx with ConsoleKit support, setup ConsoleKit and create the following file:
~/.xinitrc
Openbox with ConsoleKit supportexec ck-launch-session dbus-launch --sh-syntax --exit-with-session openbox-session
autostart
The autostart script is the ideal way to execute specific commands and programs when Openbox starts. It makes no difference if Openbox is started using the startx command or a display manager, autostart will be executed either way.
The following is an example of some of the things that could be done in an autostart file.
~/.config/openbox/autostart
Openbox autostart example# Sets the wallpaper to an image of choice. wallpaper="planet.jpeg" # Sets the DESKTOP_ENV variable to "OPENBOX" DESKTOP_ENV="OPENBOX" # The following are examples on how to call programs; # unless programs are called in a daemon mode like the # conky example below an ampersand (&) will need to be included # in order to start the command and fork it to the background # See job control for more information. conky --daemonize # Waits one second then starts the NetworkManager applet. sleep 1 && nm-applet --sm-disable & # Starts a light-weight X11 desktop panel. fbpanel & # Starts a lightweight image viewer to display the wallpaper. 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 the X server starts). numlockx &
environment
Using the environment file is the ideal place to export global variables and configure the Openbox environment:
~/.config/openbox/environment
Openbox environment exampleeval $(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` fi LANG="el_GR.UTF8"
The menu.xml file contains information for the right-click menus in Openbox. By default the right click menu is predefined with some common applications, so unless the applications are installed on the system most of the default links on the menu will not be operational.
Dynamic generation
An application called openbox-menu can be used to dynamically generate new Openbox right click menus based off information defined in the /etc/xdg/menus directory.
Install x11-misc/openbox-menu:
root #
emerge --ask x11-misc/openbox-menu
After the menu generator has been installed, run the following command to create a new menu for the present user:
user $
openbox-menu
Another excellent choice for generating an Openbox right-click menu is obmenu-generator. It can generate either static or dynamic (pipe) menus based on a user-modifiable schema and the .desktop files installed by most applications. It supports themed icons and arbitrarily nested submenus.
http://trizenx.blogspot.co.uk/2012/02/obmenu-generator.html
https://github.com/trizen/obmenu-generator
Install x11-misc/obmenu-generator:
root #
emerge --ask x11-misc/obmenu-generator
To generate a static menu with icons:
user $
obmenu-generator -i -s
To generate a pipe menu with icons:
user $
obmenu-generator -i -p
Add '-c' to automatically reconfigure a running instance of opoenbox:
user $
obmenu-generator -i -s -c
rc.xml
The rc.xml file is used to specify keyboard and mouse bindings.
The following is a list of special key 'modifiers':
Key | Description |
---|---|
S | Shift key |
C | Ctrl key |
A | Alt key |
W | Super (windows) key |
M | Meta key |
H | Hyper key |
To make a key binding, combine modifiers and a key. They are separated with the -
(dash) sign.
Case matters! S (uppercase) equates to the Shift key while s (lowercase) is the s alphabet key.
Key binding examples
Keybinding | Modifier |
---|---|
Alt+o | A-o |
Ctrl+Alt+x | C-A-x |
Ctrl+Alt+Shift+y | C-A-S-y |
Shift+s | S-s |
Any custom key bindings should go between
<keyboard>
and </keyboard>
tags in rc.xml.To open a xterm window with Super+t, add the following to the rc.xml:
~/.config/openbox/rc.xml
XTerm key bind example<keybind key="W-t"> <action name="Execute"> <command>xterm</command> </action> </keybind>
Keybinding a menu is also possible. For example, bind Openbox's right click and middle click menus with the following statement:
~/.config/openbox/rc.xml
Root-Menu key bind example<keybind key="W-x"> <action name="ShowMenu"> <menu>root-menu</menu> </action> </keybind> <keybind key="W-z"> <action name="ShowMenu"> <menu>client-list-combined-menu</menu> </action> </keybind>
In the above example, the right click menu is bound to a Super+x key press combination, and the middle click menu is bound to Super+z key press combo. It is useful to key bind applications especially when a user prefers to not use a panel program with Openbox.
Tips
Since version 3.5.0, Openbox is able to have icons next to menu entries.
- To emerge Openbox with imlib support add
imlib
USE flag to x11-wm/openbox in /etc/portage/package.useroot #
echo "x11-wm/openbox imlib" >> /etc/portage/package.use
- Re-emerge Openbox so that support for the
imlib
USE flag is considered:root #
emerge --ask --changed-use x11-wm/openbox
- Add a <showIcons>yes</showIcons> line to the <menu> section of the rc.xml file.
- Add in menu.xml icon="<path>" like this: FILE
~/.config/openbox/menu.xml
Manually add icons to Openbox example<menu label="Shells" icon="/usr/share/icons/shell.png"> <item label="xterm" icon="/usr/share/icons/xterm.png"> <action name="Execute"> <execute>xterm</execute> </action> </item>
See also
- Tint2 - A lightweight panel/taskbar
- Openbox/Guide - A Gentoo Openbox configuration guide
- LXDE - An extremely lightweight desktop environment based on Openbox.