Introduction to openbox
Openbox is a highly configurable
desktop window manager with extensive standards support. It allows
you to control almost every aspect of how you interact with your
desktop.
Note
Development versions of BLFS may not build or run some packages
properly if LFS or dependencies have been updated since the most
recent stable versions of the books.
Package Information
Openbox Dependencies
Required
a graphical
environment and Pango-1.55.0 (compiled with support for libXft)
Optional
dbus-1.14.10 (runtime), imlib2-1.12.3 (to enable
icons in the right click menu), ImageMagick-7.1.1-36 (to show desktop
backgrounds as seen in the Configuration Information section
below), PyXDG-0.28, startup-notification-0.12, and
librsvg-2.59.2
Installation of Openbox
Note
If XORG_PREFIX is not /usr
, tell
gcc about it:
export LIBRARY_PATH=$XORG_PREFIX/lib
If you only installed the Python 3 PyXDG module convert one of the
scripts to Python 3:
2to3-3.13 -w data/autostart/openbox-xdg-autostart &&
sed 's/python/python3/' -i data/autostart/openbox-xdg-autostart
Install Openbox by running the
following commands:
./configure --prefix=/usr \
--sysconfdir=/etc \
--disable-static \
--docdir=/usr/share/doc/openbox-3.6.1 &&
make
This package does not come with a test suite.
Now, as the root
user:
make install
This package creates three .desktop
files in the /usr/share/xsessions/
directory. Two of these are not appropriate in a BLFS system, so
prevent the extra files showing up as options in a display manager.
As the root
user:
rm -v /usr/share/xsessions/openbox-{gnome,kde}.desktop
Command Explanations
--sysconfdir=/etc
: This
option puts Openbox's
configuration files in /etc/xdg/openbox instead of
/usr/etc/xdg/openbox.
--docdir=/usr/share/doc/openbox-3.6.1
:
this puts a few files in a versioned directory in /usr/share/doc
.
--disable-static
: This
switch prevents installation of static versions of the libraries.
Configuring Openbox
Config Files
/etc/xdg/openbox/autostart
,
/etc/xdg/openbox/menu.xml
,
/etc/xdg/openbox/rc.xml
,
~/.config/openbox/autostart
,
~/.config/openbox/menu.xml
and
~/.config/openbox/rc.xml
Configuration Information
Openbox's right click menu can
be used to launch programs. The menu itself is configured with 2
files, /etc/xdg/openbox/menu.xml
and ~/.config/openbox/menu.xml
. To
make changes to the menu, copy /etc/xdg/openbox/menu.xml to
~/.config/openbox/menu.xml and edit it:
cp -rf /etc/xdg/openbox ~/.config
To have icons in your right click menu requires installing
imlib2-1.12.3 before you install Openbox. To set an icon for an entry in the
menu edit ~/.config/openbox/menu.xml
and add an icon to
the <item> tag like this:
<item label="Mplayer" icon="/usr/share/pixmaps/mplayer.png">
Many other aspects of Openbox's
behavior are configured with ~/.config/openbox/rc.xml
such as what
keybindings are used to launch programs or which mouse button
launches the main menu.
Details of the theme that Openbox applies to window decorations are
configured in ~/.config/openbox/rc.xml
. You can get a list of
the available themes with the command:
ls -d /usr/share/themes/*/openbox-3 | sed 's#.*es/##;s#/o.*##'
Starting Openbox
To automatically start openbox when you start
Xorg:
echo openbox > ~/.xinitrc
If you want to set a background image to your desktop you can use
display and launch it from
~/.xinitrc just before openbox:
cat > ~/.xinitrc << "EOF"
display -backdrop -window root /path/to/beautiful/picture.jpeg
exec openbox
EOF
Or if you like a bit of variety, put a selection of images in a
folder (in this example, the directory ~/.config/backgrounds) and
choose one at random each time you xinit:
cat > ~/.xinitrc << "EOF"
# make an array which lists the pictures:
picture_list=(~/.config/backgrounds/*)
# create a random integer between 0 and the number of pictures:
random_number=$(( ${RANDOM} % ${#picture_list[@]} ))
# display the chosen picture:
display -backdrop -window root "${picture_list[${random_number}]}"
exec openbox
EOF
If you like to have the numlock key set when you start Xorg,
install
Numlockx and add that to your xinitrc. Another useful
application is dbus-1.14.10:
cat > ~/.xinitrc << "EOF"
. /etc/profile
picture_list=(~/.config/backgrounds/*)
random_number=$(( ${RANDOM} % ${#picture_list[*]} ))
display -backdrop -window root "${picture_list[${random_number}]}"
numlockx
eval $(dbus-launch --auto-syntax --exit-with-session)
lxpanel &
exec openbox
EOF