Openbox

From Gentoo Linux Wiki
Jump to: navigation, search

Window managers TOC

Back to X.Org


Openbox is a highly configurable, next generation window manager with extensive standards support. [1] Openbox is a variation on the *box window manager where right-click (or any other custom binding) with the mouse will bring up the (user-configurable) root-menu

What makes Openbox unique from the other *box's is its ability to have dynamic generated menus (pipemenu's). A shell script,C-program... can be placed into the configuration of Openbox's menu generation and as long as its output is valid Openbox xml for its menu's. This allows a menu that is not static like other window managers (xml feeds, new email list...)


Contents

[edit] Placeholder

Configuration for Openbox is split into 3 files

  • autostart
    • only used if starting the openbox-session wrapper script, not just openbox. Intended for use when started from a login manager.
  • menu.xml
  • rc.xml

[edit] Autostart

Openbox on its own will load a default menu, default resource config and a preconfigured list of startup applications The defaults are listed in /etc/xdg/openbox

The default autostart.sh will

  • set a default background colour
  • start a user dbus session
  • pre-configure GTK themes
    • if gnome detected load gnome-session-daemon
    • else if xfce is detected load xfce-mcs-manager
  • load any KDE startup apps
  • run XDG autostartup


Such autostart can be user-overridden with a ~/.config/openbox/autostart.sh file of their own from which anything the user wants for a better desktop experience can be launched.

File: ~/.config/openbox/autostart.sh
#!/bin/bash

feh --bg-scale "$HOME"/Wallpaper/OTW-wallpapers/bliques_by_kjon.jpg &    
# set background
xscreensaver -nosplash &                                                 
# launch screensaver daemon
urxvtd -q -f -o                                   
# launch unicode-rxvt daemon 

sleep 2                                                                  
# allow Openbox to fully load to then load desktop apps

if [ $(pgrep Thunar) ];                                                  
# using Thunar as automounter
    then true;
    else Thunar --daemon &
fi

tint &                                                                   
# panel
conky --daemonize                                  
# sys monitor
urxvtc -name deskshell -tr -sh 100 +sb -fg White -depth 32 &             
# shell on the desk
trayer --transparent true --alpha 190 --widthtype request \
--edge bottom --align right --heighttype pixel --height 24 \
--tint 000000 --SetDockType true &           
# tray dock
ossxmix -b -x  &                                                         
# OSS4 mixer applet

each process within the autostart.sh need to be backgrounded by appending & to fork the process, except those which are equipped with an option to fork, i.e. urxvt -f, conky -d (except Thunar --daemon, which does not really fork until quitting time, see Thunar(1))

Note: If the user wants to load the default autostart.sh as well as customise their own startup applications, then
. $GLOBALAUTOSTART
needs to be added to the top of: ~/.config/openbox/autostart.sh

[edit] Menu config

the application menu of openbox (default keybind is right mouse on desktop) is defined in an xml document called menu.xml Just like with the autostart.sh there is a default menu that will be used if no user menu.xml is provided

  • Default: /etc/xdg/openbox/menu.xml
  • User: ~/.config/openbox/menu.xml

There are multiple ways to configure the user menu.xml

  • edit the xml by hand and follow the openbox menu guidelines [2]
  • emerge obmenu
    a graphical application to aid in creating a user menu.xml
  • emerge obmenu
    and utilize the command line obm-xdg application that will generate an applications menu based upon Gnome menus layout

obm-xdg can be used to dynamically generate the openbox applications menu thus removing the need to re-edit your menu.xml every time an app is installed/removed Add this to your menu.xml to ~/.config/openbox/menu.xml

<menu execute="obm-xdg" id="xdg-menu" label="System Menu"/>

[edit] RC config

[edit] Pipe Menus

See the Openbox Pipemenus page for more information.

[edit] Create custom keyboard shortcuts

To create custom keyboard shortcuts, edit your ~/.config/openbox/rc.xml accordingly (If you are a LXDE user, the file is named ~/.config/openbox/lxde-rc.xml) :

File: ~/.config/openbox/rc.xml
[...]
<keyboard>
[...]
<keybind key="KeyCombination">
  <action name="Execute">
    <command>path-to-your-program</command>
  </action>
</keybind>
[...]
Note: Replace KeyCombination by the key combination you want. Replace CTRL by C, ALT by A, SHIFT by S, SUPER (or Windows) by W, and separate your keystrokes by a dash (-).

Example :

File: ~/.config/openbox/rc.xml
<keybind key="A-C-f">
  <action name="Execute">
    <command>/usr/bin/firefox</command>
  </action>
</keybind>
Note: This configuration will bind firefox to a ALT+CTRL+F keystroke. (Use firefox-bin if you installed firefox-bin.)

See the Openbox Binding page for more information.

[edit] Setting up shortcuts with obkey

There is a tool available that can make this process more convenient, called obkey .

[edit] Tips

[edit] 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: "x11-wm/openbox imlib" and run "#emerge x11-wm/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">
		<execute>xterm</execute>
	</action></item>
Personal tools
In other languages