Difference between revisions of "Openbox"

From ArchWiki
Jump to navigation Jump to search
m (no more plus in gtk)
 
(723 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
[[Category:Desktop environments (English)]][[Category:HOWTOs (English)]]
+
[[Category:Stacking WMs]]
{{i18n_links_start}}
+
[[cs:Openbox]]
{{i18n_entry|Česky|OpenBox (Česky)}}
+
[[de:Openbox]]
{{i18n_entry|English|Openbox}}
+
[[el:Openbox]]
{{i18n_entry|Español|Openbox (Español)}}
+
[[es:Openbox]]
{{i18n_entry|Français|Openbox (Français)}}
+
[[fr:Openbox]]
{{i18n_entry|Italiano|Openbox_(Italiano)}}
+
[[it:Openbox]]
{{i18n_entry|Nederlands|Openbox_(Nederlands)}}
+
[[ja:Openbox]]
{{i18n_entry|Русский|Openbox (Русский)}}
+
[[ko:Openbox]]
{{i18n_entry|简体中文|Openbox(简体中文)}}
+
[[lt:Openbox]]
{{i18n_links_end}}
+
[[nl:Openbox]]
 +
[[pl:Openbox]]
 +
[[ru:Openbox]]
 +
[[sk:Openbox]]
 +
[[sr:Openbox]]
 +
[[zh-hans:Openbox]]
 +
[[zh-hant:Openbox]]
 +
{{Related articles start}}
 +
{{Related|Desktop environment}}
 +
{{Related|Display manager}}
 +
{{Related|File manager functionality}}
 +
{{Related|Xdg-menu}}
 +
{{Related|Oblogout}}
 +
{{Related articles end}}
  
Openbox is a lightweight and highly configurable window manager with extensive standards support. Its features are well-documented at the [http://icculus.org/openbox/ official website]. This article will pertain to running Openbox under Arch Linux.
+
[http://openbox.org/wiki/Main_Page Openbox] is a lightweight, powerful, and highly configurable ''stacking'' [[window manager]] with extensive standards support. It may be built upon and run independently as the basis of a unique [[desktop environment]], or within other integrated desktop environments such as [[KDE]] and [[Xfce]], as an alternative to the window managers they provide. The [[LXDE]] desktop environment is itself built around Openbox.
  
 
== Installation ==
 
== Installation ==
  
Openbox is available from the standard repositories:
+
[[Install]] the {{Pkg|openbox}} package.
# pacman -S openbox
 
  
Once installed, pacman will direct you to copy the default {{Filename|menu.xml}} and {{Filename|rc.xml}} configuration files to <tt>~/.config/openbox/</tt>, for example:
+
== Starting ==
  
{{Note | Do this as a regular user, not as root.}}
+
=== Standalone ===
  
$ mkdir -p ~/.config/openbox/
+
Run {{ic|openbox}} or {{ic|openbox-session}} with [[xinit]]. Note that only {{ic|openbox-session}} provides [[#Autostart]].
$ cp /etc/xdg/openbox/rc.xml ~/.config/openbox/rc.xml
 
$ cp /etc/xdg/openbox/menu.xml ~/.config/openbox/menu.xml
 
  
{{Filename|rc.xml}} is the core configuration file for Openbox. It is used to manage keyboard shortcuts, themes, virtual desktops and other features.
+
{{Note|After executing openbox-session, there is only a blank grey screen. Try to move your mouse and '''right click''' to get an openbox menu to make sure that it is actually working.}}
  
{{Filename|menu.xml}} controls the Openbox application menu that appears when you click on your desktop.  The default items are pretty sparse, but it's very easy to modify the menu structure to suit your needs.  See the menu section below for more details, or visit the [http://icculus.org/openbox/ Openbox website].
+
=== Other desktop environments ===
  
== Stand-alone window manager ==
+
{{Note|
 +
* When replacing the native window manager of a [[desktop environment]] with Openbox, keep in mind that Openbox does not provide any compositing effects (such as transparency). See [[#Compositing effects]].
 +
* Openbox does work with GNOME applications (but see [[GTK#Client-side decorations]]). [http://comments.gmane.org/gmane.comp.window-managers.openbox/6595]}}
  
To run Openbox on its own, simply add the following to the bottom of {{Filename|~/.xinitrc}}:
+
See [[Desktop environment#Use a different window manager]].
exec openbox-session
 
  
If you have used another window manager before, such as Xfce, and Openbox wont start after logging out of X, try moving the autostart folder:
+
== Configuration==
mv ~/.config/autostart ~/.config/autostart-bak
 
  
== Window manager for Desktop Environments ==
+
{{Note|Local configuration files will always override global equivalents.}}
  
=== GNOME ===
+
Four key files form the basis of the [http://openbox.org/wiki/Configuration openbox configuration], each serving a unique role. They are: {{ic|rc.xml}}, {{ic|menu.xml}}, {{ic|autostart}}, and {{ic|environment}}. Although these files are discussed in more detail below, to start configuring Openbox,  it will first be necessary to create a '''local''' Openbox profile (i.e for your specific user account) based on them. This can be done by copying them from the '''global''' {{ic|/etc/xdg/openbox}} profile (applicable to any and all users) as a template:
==== GNOME 2.26 ====
 
'''''Follow the next guide for GNOME 2.24. If it fails try this:'''''
 
  
If after installing openbox and trying to log into the 'Gnome/openbox' session but it always fails then you can do the following as one way to achieve running openbox as your window manager every time you log into the 'Gnome' session from your login manager (xdm, gdm, kdm, entrance, slim, etc.)
+
$ mkdir -p ~/.config/openbox
 +
$ cp -a /etc/xdg/openbox/. ~/.config/openbox/
  
#Log into your Gnome only session (which would still be using metacity as its window manager) if you aren't already.
+
=== rc.xml ===
#Install openbox if you have not done so already
 
#Explore your menus to ''System &rarr; Preferences &rarr; Startup Applications'' (possibly named 'Session' for older versions of Gnome)
 
#Open Startup Application, select '+ Add' and enter the text as seen in the box below whilst omitting the text behind the #.
 
#Now hit the 'Add' button for that data entry window and make sure the checkbox beside your new entry is selected.
 
#Thus log out of your gnome session and log back in and you should be running openbox as your window manager.
 
#Enjoy!
 
  
Name:    Openbox Windox Manager          # Can be changed
+
{{Tip|Custom keyboard shortcuts (keybindings) must be added to the {{ic|<keyboard>}} section of this file, and underneath the {{ic|<nowiki><!-- Keybindings for running aplications --></nowiki>}} heading.}}
Command: openbox --replace              # Text should not be removed from this line, but possibly added to it
 
Comment: Replaces metacity with openbox  # Can be changed
 
  
This creates an entry in a startup list which is executed by gnome everytime that particular user's gnome-session is started.
+
{{ic|~/.config/openbox/rc.xml}} is the main configuration file, responsible for determining the behaviour and settings of the overall session, including:
  
==== GNOME 2.24 ====
+
* Keyboard shortcuts (e.g. starting applications; controlling the volume)
First, create {{Filename|/usr/share/applications/openbox.desktop}} containing the following:
+
* Theming
[Desktop Entry]
+
* Desktop and Virtual desktop settings, and
Type=Application
+
* Application Window settings
Encoding=UTF-8
 
Name=OpenBox
 
Exec=openbox
 
NoDisplay=true
 
# name of loadable control center module
 
X-GNOME-WMSettingsModule=openbox
 
# name we put on the WM spec check window
 
X-GNOME-WMName=OpenBox
 
Then, in gconf, set  '''/desktop/gnome/session/required_components/windowmanager''' to '''openbox''':
 
$ gconftool-2 -s -t string /desktop/gnome/session/required_components/windowmanager openbox
 
Finally, choose the '''GNOME''' session in the GDM sessions menu.
 
  
==== GNOME 2.22 and previous ====
+
This file is also pre-configured, meaning that it will only be necessary to amend existing content in order to customise behaviour to suit personal preference.
# If you use GDM, select the "GNOME/Openbox" login option
 
# If you use startx, add {{Codeline|exec openbox-gnome-session}} to {{Filename|~/.xinitrc}}
 
# From the shell:
 
$ xinit /usr/bin/openbox-gnome-session
 
  
=== KDE ===
+
{{Note|Per-application settings pertaining to fixed placement of applications per monitor will only work if the x & y position have also been defined.}}
# If you use KDM, select the "KDE/Openbox" login option
 
# If you use startx, add {{Codeline|exec openbox-kde-session}} to {{Filename|~/.xinitrc}}
 
# From the shell:
 
$ xinit /usr/bin/openbox-kde-session
 
  
=== Xfce4 ===
+
=== menu.xml ===
Log into a normal Xfce4 session. From your terminal of choice, do:
 
$ killall xfwm4 ; openbox & exit
 
  
This will kill xfwm4, run Openbox, and close the terminal.  
+
{{ic|~/.config/openbox/menu.xml}} defines the type and behaviour of the desktop menu, accessible by right-clicking the background. Although the default provided is a '''static menu''' (meaning that it will not automatically update when new applications are installed), it is possible to employ the use of '''dynamic menus''' that will automatically update as well.  
  
Log out, making sure to check the "Save session for future logins" checkbox. On next login, Xfce4 will use Openbox as its WM. To be able to exit the session using xfce4-session, open your file {{Filename|~/.config/openbox/menu.xml}} (if it isn't there, copy it from {{Filename|/etc/xdg/openbox/menu.xml}}).  
+
The available options are discussed extensively below in the [[#Menus]] section.
  
Look for the entry:
+
=== Autostart ===
  
  <item label="Exit Openbox">
+
{{ic|openbox-session}} provides two autostart mechanisms: [[XDG Autostart]] (which only works if {{Pkg|python2-xdg}} is installed) and [http://openbox.org/wiki/Help:Autostart Openbox's own autostart mechanism].
    <action name="Exit">
+
 
      <prompt>yes</prompt>
+
Openbox's own autostart mechanism:
    </action>
+
 
  </item>
+
* sources {{ic|/etc/xdg/openbox/environment}}
 +
* sources {{ic|~/.config/openbox/environment}}
 +
* runs {{ic|/etc/xdg/openbox/autostart}}
 +
* runs {{ic|~/.config/openbox/autostart}}
 +
 
 +
Issues regarding commands in {{ic|~/.config/openbox/autostart}} being executed out of order (or skipped altogether) are often resolved by the addition of small delays. For instance:
 +
 
 +
xset -b
 +
(sleep 3s && nm-applet) &
 +
(sleep 3s && conky) &
 +
 
 +
=== environment ===
 +
 
 +
{{ic|~/.config/openbox/environment}} can be used to export and set relevant environmental variables such as to:
 +
 
 +
* Define new pathways (e.g. execute commands that would otherwise require the entire pathway to be listed with them)
 +
* Change language settings, and
 +
* Define other variables to be used (e.g. the fix for GTK theming could be listed here)
 +
 
 +
=== Themes ===
 +
 
 +
Install {{Pkg|obconf}} and/or {{Pkg|lxappearance-obconf}} for a GUI to configure visual settings and theming.
 +
 
 +
A good selection of themes are available in the {{AUR|openbox-themes}} package or the [[AUR]]. Some [[GTK#Themes]] come with an Openbox theme as well. Both Openbox-specific and Openbox-compatible themes will be installed to the {{ic|/usr/share/themes}} directory and will also be immediately available for selection.
 +
 
 +
[https://www.box-look.org/browse/ord/latest/ box-look.org] is an excellent and well-established source of themes. [http://www.deviantart.com/ deviantART.com] is another excellent resource. Many more can be found online.
 +
 
 +
==== Edit or create ====
 +
 
 +
{{Tip|It's better to copy a theme to your home directory than to edit those found in {{ic|/usr/share/themes/}}. This will retain the original should anything go wrong and ensure that your changes are not overwritten on update.}}
 +
 
 +
The process of creating new or modifying existing themes is covered extensively at the official [http://openbox.org/wiki/Help:Themes openbox.org] website. {{AUR|obtheme}} is a user-friendly GUI for doing so.
 +
 
 +
=== GUI configuration ===
 +
 
 +
Several GUI applications are available to quickly and easily configure your Openbox desktop.
 +
 
 +
* {{App|ObConf|A GTK2 based configuration tool for the Openbox window manager.|http://openbox.org/wiki/ObConf:About|{{Pkg|obconf}}}}
 +
* {{App|LXAppearance ObConf|Plugin for LXAppearance to configure Openbox. Note that not all options to configure Openbox are available in this plugin, so you might want to install obconf anyway.|http://lxde.org|{{Pkg|lxappearance-obconf}}}}
 +
* {{App|LXInput|LXDE keyboard and mouse configuration|http://lxde.org|{{Pkg|lxinput}}}}
 +
* {{App|LXRandR|LXDE monitor configuration.|http://wiki.lxde.org/en/LXRandR|{{Pkg|lxrandr}}}}
 +
* {{App|obkey|Configure Openbox keyboard shortcuts|https://code.google.com/p/obkey/|{{AUR|obkey}}}}
 +
* {{App|ob-autostart|A simple autostart application for Openbox.|http://pastebin.com/012YgXTk|{{AUR|ob-autostart}}}}
 +
* {{App|obapps|Graphical tool for configuring application settings in Openbox.|https://sourceforge.net/projects/obapps/|{{AUR|obapps}}}}
 +
 
 +
Programs and applications relating to the configuration of Openbox's desktop menu are discussed in the [[#Menus|Menus]] section.
 +
 
 +
== Openbox reconfiguration ==
 +
 
 +
{{Tip|where not already present, it would be worthwhile adding this command to a menu and/or as a keybind for convenience.}}
 +
 
 +
Openbox will not always automatically reflect any changes made to its configuration files within a session. As a consequence, it will be necessary to manually reload those files after they have been edited. To do so, enter the following command:
 +
 
 +
$ openbox --reconfigure
 +
 
 +
Where intending to add this command as a keybind to {{ic|~/.config/openbox/rc.xml}}, it will only be necessary to list the command as {{ic|reconfigure}}. An example has been provided below, using the {{ic|Super}}+{{ic|F11}} keybind:
 +
 
 +
<keybind key="W-F11">
 +
  <action name="Reconfigure"/>
 +
</keybind>
 +
 
 +
== Keybinds ==
  
and change it to:
+
All keybinds must be added to the {{ic|~/.config/openbox/rc.xml}} file, and below the {{ic|<nowiki><!-- Keybindings for running aplications --></nowiki>}} heading. Although a brief overview has been provided here, a more in-depth explanation of keybindings can be found at [http://openbox.org/wiki/Help:Bindings openbox.org].
  
  <item label="Exit Openbox">
+
Keybinds can be added to the configuration file using the following syntax:
    <action name="Execute">
 
      <prompt>yes</prompt>
 
    <command>xfce4-session-logout</command>
 
    </action>
 
  </item>
 
  
Otherwise, using the "Exit" entry of the root-menu will cause Openbox to terminate its execution, leaving you without a window manager.
+
<keybind key="'''my-key-combination'''">
 +
  <action name="'''my-action'''">
 +
    '''...'''
 +
  </action>
 +
</keybind>
  
If you have an issue changing between virtual desktops with the mouse wheel skipping over virtual desktops, open your {{Filename|~/.config/openbox/rc.xml}} file and move the mouse binds with actions "DesktopPrevious" and "DesktopNext" from the context "Desktop" to the context "Root" (you may need to define the Root context).
+
The action name for running an external command is ''Execute''. Use the following syntax to define an external command to execute:
  
If you want to use the Openbox root-menu instead of Xfce's, you may terminate Xfdesktop by running the following command in a terminal:
+
<action name="Execute">
  $ xfdesktop --quit
+
  <command>'''my-command'''</command>
 +
  </action>
  
However, Xfdesktop manages the wallpaper and desktop icons, requiring you to use other utilities, such as ROX, for these functions.
+
See [http://openbox.org/wiki/Help:Actions the Openbox wiki] for a list of all available actions.
  
(When terminating Xfdesktop, the above issue with the virtual desktops is no longer a problem.)
+
{{Tip|The {{AUR|obkey}} utility provides a graphical interface for configuring key bindings. Before using ''obkey'', you should use ''obconf'' to create {{ic|~/.config/openbox/rc.xml}}.}}
  
== Preferences ==
+
While the use of standard alpha-numeric keys for keybindings is self-explanatory, special names are assigned to other types of keys, such as {{ic|modifiers}}, {{ic|multimedia}} and {{ic|navigation}}.
  
Currently, there are two options for configuring the core Openbox preferences; manually edit the {{Filename|rc.xml}}, or use the ObConf tool.
+
=== Modifiers ===
  
=== Manual configuration ===
+
{{ic|Modifier}} keys play an important role in keybindings (e.g. holding down the {{ic|shift}} or {{ic|CTRL / control}} key in combination with another key to undertake an action). Using modifiers helps to prevent conflicting keybinds, whereby two or more actions are linked to the same key or combination of keys. The syntax to use a modifier with another key is:
  
To configure Openbox manually, simply edit {{Filename|~/.config/openbox/rc.xml}} with your favorite text editor. The config file provides plenty of comments throughout, and [http://icculus.org/openbox/index.php/Help:Contents full documentation] is available at the official website.
+
"<modifier>-<key>"
  
=== ObConf ===
+
The modifier codes are as follows:
  
[http://icculus.org/openbox/index.php/ObConf:About ObConf] is GUI-based Openbox configuration tool, which can be used to set most preferences including themes, virtual desktops, window properties and desktop margins.
+
* {{ic|S}}: Shift
 +
* {{ic|C}}: Control / CTRL
 +
* {{ic|A}}: Alt
 +
* {{ic|W}}: Super / Windows
 +
* {{ic|M}}: Meta
 +
* {{ic|H}}: Hyper (If it is bound to something)
  
To install ObConf, run:
+
=== Multimedia keys ===
# pacman -S obconf
 
  
{{Note | ObConf cannot be used to configure keyboard shortcuts and some other advanced features. For these modifications, you must edit {{Filename|rc.xml}} manually (see above). Other option is [http://code.google.com/p/obkey/ ObKey] application (available in [[AUR]]).}}
+
Where available, it is possible to set the appropriate {{ic|multimedia}} keys to perform their intended functions, such as to control the volume and/or the screen brightness. These will usually be integrated into the {{ic|function}} keys, and are identified by their appropriate symbols. See [[Extra keyboard keys]] for details.
  
=== Application configuration ===
+
The volume and brightness multimedia codes are as follows (note that commands will still have to be assigned to them to actually function):
  
Openbox features per-application settings, allowing you to define rules for your programs. For example, you can:
+
* {{ic|XF86AudioRaiseVolume}}: Increase volume
* load your web browser on a certain desktop
+
* {{ic|XF86AudioLowerVolume}}: Decrease volume
* load your terminal without a window border
+
* {{ic|XF86AudioMute}}: Mute / unmute volume
* load your torrent client at a certain position on your screen
+
* {{ic|XF86MonBrightnessUp}}: Increase screen brightness
 +
* {{ic|XF86MonBrightnessDown}}: Decrease screen brightness
  
These are defined in {{Filename|~/.config/openbox/rc.xml}}. As you might expect, the instructions are well-documented within the file itself. Full details can also be found here: http://icculus.org/openbox/index.php/Help:Applications
+
For a full list of XF86 multimedia keys, see the [http://wiki.linuxquestions.org/wiki/XF86_keyboard_symbols LinuxQuestions wiki].
  
== Menus ==
+
==== Volume control ====
  
The default Openbox menu includes a variety of applications to get you started, but you'll probably want to customize this at some point. There are a number of ways to do so:
+
What commands should be used for controlling the volume will depend on whether [[ALSA]], [[PulseAudio]], or [[OSS]] is used for sound.
  
=== Manual configuration ===
+
*ALSA: see [[Advanced Linux Sound Architecture#Keyboard volume control]].
 +
*PulseAudio: see [[PulseAudio#Keyboard volume control]]
 +
*OSS: see [[OSS#Using multimedia keys with OSS]].
  
Similar to the {{Filename|rc.xml}} file, you can edit {{Filename|~/.config/openbox/menu.xml}} with your favourite text editor. Although many of the settings are self-explanatory, [http://icculus.org/openbox/index.php/Help:Menus full documentation] is available.
+
=== Navigation keys ===
  
=== MenuMaker ===
+
These are the directional / arrow keys, usually used to move the cursor up, down, left, or right. The (self-explanatory) navigation codes are as follows:
  
[http://menumaker.sourceforge.net/ MenuMaker] is a powerful tool that creates XML-based menus for a variety of Window Managers, including Openbox.  MenuMaker will search your computer for executable programs and create an XML menu based on the results.  It can be configured to exclude Legacy X, GNOME, KDE, or Xfce applications if the user desires.
+
* {{ic|Up}}: Up
 +
* {{ic|Down}}: Down
 +
* {{ic|Left}}: Left
 +
* {{ic|Right}}: Right
  
MenuMaker is available in the community repository:
+
== Menus ==
# pacman -S menumaker
 
  
Once installed, you can generate a complete menu by running:
+
It is possible to employ three types of menu in Openbox: {{ic|static}}, {{ic|pipes}} (dynamic), and {{ic|generators}} (static or dynamic). They may also be used alone or in any combination.
$ mmaker -v OpenBox3
 
  
By default, MenuMaker will not overwrite an existing menu.xml.  To do so, run it with the -f (force) argument:
+
=== Static ===
  
$ mmaker -vf OpenBox3
+
As the name would suggest, this default type of menu does not change in any way, and may be manually edited and/or (re)generated automatically through the use on an appropriate software package.
  
To see a full list of options, run {{Codeline|mmaker --help}}.
+
Fast and efficient, while this type of menu can be used to select applications, it can also be useful to access specific functions and/or perform specific tasks (e.g. desktop configuration), leaving the access of applications to another process (e.g. the {{Pkg|synapse}} or {{Pkg|xfce4-appfinder}} applications).
  
This will give you a pretty thorough menu. Now you can modify the menu.xml by hand, or simply regenerate the list whenever you install new software.
+
The {{ic|~/.config/openbox/menu.xml}} file will be the sole source of static desktop menu content.
  
=== Obmenu ===
+
==== menumaker ====
  
Obmenu is a GUI-based menu editor for Openbox. For those who don't enjoy editing XML source code, this is probably the best option for you.
+
{{Pkg|menumaker}} automatically generates {{ic|xml}} menus for several window managers, including Openbox, [[Fluxbox]], [[IceWM]] and [[Xfce]]. It will search for all installed executable programs and consequently create a menu file for them. It is also possible to configure MenuMaker to exclude certain application types (e.g. relating to [[GNOME]] or [[KDE]]), if desired.
  
It is available in the community repository:
+
Once installed and executed, it will automatically generate a new {{ic|~/.config/openbox/menu.xml}} file. To avoid overwriting an existing file, enter:
# pacman -S obmenu
 
  
Once installed, simply run {{Codeline|obmenu}} and add or remove the desired applications.
+
$ mmaker -v OpenBox3
  
==== Obm-xdg ====
+
Otherwise, to overwrite an existing file, add the {{ic|force}} argument ({{ic|f}}):
  
<tt>obm-xdg</tt> is a command-line tool that comes with Obmenu. It can generate a categorized sub-menu of installed GTK/GNOME applications.
+
$ mmaker -vf OpenBox3
  
To use obm-xdg, add the following line to {{Filename|~/.config/openbox/menu.xml}}:
+
Once a new {{ic|~/.config/openbox/menu.xml}} file has been generated it may then be manually edited, or configured using a GUI menu editor, such as {{AUR|obmenu}}.
<menu execute="obm-xdg" id="xdg-menu" label="xdg"/>
 
  
Then run {{Codeline|openbox --reconfigure}} to refresh the Openbox menu.  You should now see a sub-menu labeled '''xdg''' in your menu.
+
==== obmenu ====
  
{{Note | If you do not have GNOME installed, then you need to install '''gnome-menus''' package for obm-xdg to work.}}
+
{{Warning|{{ic|obm-xdg}} - a pipe menu to generate a list of [[GTK]] and [[GNOME]] applications - is also provided with obmenu. However, it has long-running bugs whereby it may produce an invalid output, or even not function at all. Consequently it has been omitted from discussion.}}
  
=== Python based xdg menu script ===
+
{{AUR|obmenu}} is a "user-friendly" GUI application to edit {{ic|~/.config/openbox/menu.xml}}, without the need to code in {{ic|xml}}.
  
This script can be found in Fedora's Openbox package. You will only have to put the script somewhere and add a menu entry.
+
==== xdg-menu ====
  
Here is my paste: http://pastebin.com/f2f827625
+
{{Pkg|archlinux-xdg-menu}} will automatically generate a menu based on {{ic|xdg}} files contained within the {{ic|/etc/xdg/}} directory for numerous Window Managers, including Openbox. Review the [[Xdg-menu#OpenBox]] article for further information.
And here is the head: http://cvs.fedoraproject.org/viewvc/devel/openbox/xdg-menu?view=markup
 
  
Download the one you like (maybe you'll prefer the head version of course). You can put the file anywhere, I used ~/Documents/build/xdg-menu (just modify the menu entry later according to YOUR filename/path.)
+
==== logout menu options ====
  
Then open your menu.xml with your favourite text editor and add the following entry where you want the new menu (of course, you can modify the label however you want):
+
{{Tip|The commands provided can also be attached to [[#Keybinds|keybinds]].}}
<menu id="apps-menu" label="xdgmenu" execute="python /home/shiki/Documents/build/xdg-menu"/>
 
  
Save the file, and run: {{Codeline|openbox --reconfigure}}.
+
The {{ic|~/.config/openbox/menu.xml}} file can be edited in order to provide a sub-menu with the same options as provided by [[#oblogout|oblogout]]. The sample script below will provide all of these options, with the exception of the ability to lock the screen:
  
=== Pipe menus ===
+
<menu id="exit-menu" label="Exit">
 +
<item label="Log Out">
 +
<action name="Execute">
 +
<command>openbox --exit</command>
 +
</action>
 +
</item>
 +
<item label="Shutdown">
 +
<action name="Execute">
 +
<command>systemctl poweroff</command>
 +
</action>
 +
</item>
 +
<item label="Restart">
 +
<action name="Execute">
 +
        <command>systemctl reboot</command>
 +
</action>
 +
</item>
 +
<item label="Suspend">
 +
<action name="Execute">
 +
        <command>systemctl suspend</command>
 +
</action>
 +
</item>
 +
<item label="Hibernate">
 +
<action name="Execute">
 +
        <command>systemctl hibernate</command>
 +
</action>
 +
</item>
 +
</menu>
  
Openbox (and other WMs like WindowMaker and PekWM) allow you to write scripts that dynamically build menus on the fly.  Some examples are system monitors, media player controls, and weather forecasts.  Many examples can be found on the openbox [http://icculus.org/openbox/index.php/Openbox:Pipemenus site].
+
Once the entries have been composed, add the following line to present the sub-menu where desired within the main desktop menu (usually as the last entry):
  
Xyne has also created a file browser and brisbin33 has one for scanning for / connecting to wireless hot spots (requires netcfg). The relevant forum posts for these utilities are [http://bbs.archlinux.org/viewtopic.php?id=77197&p=1 here] and [http://bbs.archlinux.org/viewtopic.php?id=78290 here]
+
  <menu id="exit-menu"/>
  
== Startup programs ==
+
=== Pipes ===
  
Openbox features support for running programs at startup. This is provided by the "openbox-session" command.
+
{{Tip|It is entirely feasible for a static menu to contain one or more pipe sub-menus. The functionality of some pipe menus may also rely on the installation of relevant software packages.}}
  
There are two ways to enable autostart:
+
This type of menu is in essence a script that provides dynamic, refreshed lists on-the-fly as and when run. These lists may be used for multiple purposes, including to list applications, to provide information, and to provide control functions. Pre-configured pipe menus can be installed, although not from the [[official repositories]]. More experienced users can also modify and/or create their own custom scripts. Again, {{ic|~/.config/openbox/menu.xml}} may and commonly will contain several pipe menus.
# If you use startx/xinit to log into your X session, edit {{Filename|~/.xinitrc}} and change the line that executes ''openbox'' to execute '''openbox-session''' instead.
 
# If you log in with GDM/KDM, then select the ''Openbox'' session and it will automatically use autostart.
 
  
Startup programs are managed in {{Filename|~/.config/openbox/autostart.sh}}.  Full instructions and best practices for how to do this are available at the [http://openbox.org/wiki/Help:Autostart Openbox website].
+
==== Examples ====
  
== Themes and appearance ==
+
* {{AUR|openbox-xdgmenu}}: fast xdg-menu converter to xml-pipe-menu
 +
* {{AUR|obfilebrowser}}: Application and file browser
 +
* {{AUR|obdevicemenu}}: Management of removable media with [[Udisks]]
 +
* [https://bbs.archlinux.org/viewtopic.php?pid=1345031 wifi pipe menu]: Wireless networking using [[Netctl]]
  
With the exception of the Openbox Themes topic, the following section is intended for users who have configured Openbox to run as a standalone desktop, without the assistance of GNOME, KDE or Xfce.
+
[http://openbox.org/wiki/Openbox:Pipemenus Openbox.org] also provides a further list of pipe menus.
  
=== Openbox themes ===
+
=== Generators ===
  
Openbox themes control the appearance of window borders, including the titlebar and titlebar buttons. They also determine the appearance of the application menu and on-screen display (OSD).
+
This type of menu is akin to those provided by the taskbars of desktop environments such as [[Xfce]] or [[LXDE]]. Automatically updating on-the-fly, this type of menu can be powerful and very convenient. It may also be possible to add custom categories and menu entries; read the documentation for your intended dynamic menu to determine if and how this can be done.
  
Additional themes are available from the standard repositories:
+
A menu generator will have to be executed from the {{ic|~/.config/openbox/menu.xml}} file.
  
# pacman -S openbox-themes
+
==== obmenu-generator ====
  
This package is by no means definitive. You can download more themes at websites such as:
+
{{Tip|icons can still be disabled in {{AUR|obmenu-generator}}, even where enabled in {{ic|~/.config/openbox/rc.xml}}.}}
*[http://www.box-look.org/index.php?xcontentmode=7402 box-look.org]
 
*[http://customize.org/browse/tags/openbox customize.org]
 
*http://www.minuslab.net/themes/
 
*http://celo.wordpress.com/themes/
 
*http://vault.openmonkey.com/pages/openbox
 
*http://hewphoria.com/?p=submission&type=theme&cat=7
 
  
Downloaded themes should be extracted to <tt>~/.themes</tt> and can be installed or selected with the [[Openbox#Preferences|ObConf]] tool.
+
{{AUR|obmenu-generator}} is highly recommended despite being an unofficial package. With the ability to be used as a static or dynamic menu, it is highly configurable, powerful, and versatile. Menu categories and individual entries may also be easily hidden, customised, and/or added with ease. The [http://trizenx.blogspot.co.uk/2012/02/obmenu-generator.html official homepage] provides further information and screenshots.
  
Creating new themes is fairly easy and again [http://icculus.org/openbox/index.php/Help:Themes well-documented].
+
Below is an example of how obmenu-generator would be dynamically executed without icons in {{ic|~/.config/openbox/menu.xml}}:
  
For a GUI theme editor, take a look at [http://xyne.archlinux.ca/info/obtheme ObTheme].
+
<?xml version="1.0" encoding="utf-8"?>
 +
<openbox_menu>
 +
    <menu id="root-menu" label="OpenBox 3" execute="/usr/bin/obmenu-generator">
 +
    </menu>
 +
</openbox_menu>
  
=== GTK Themes ===
+
To automatically iconify entries, the {{ic|-i}} option would be added:
  
==== GTK2/GTK+ ====
+
<menu id="root-menu" label="OpenBox 3" execute="/usr/bin/obmenu-generator -i">
  
GTK+ themes can be managed easily with the '''[[LXDE | lxappearance]]''', '''gtk-chtheme''', or '''switch2''' utilities. To install, run:
+
==== openbox-menu ====
# pacman -S lxappearance
 
and/or
 
# pacman -S gtk-chtheme
 
and/or
 
# pacman -S gtk-theme-switch2
 
  
Now you can simply run {{Codeline|lxappearance}}, {{Codeline|gtk-chtheme}} or {{Codeline|switch2}} to set the desired theme.
+
{{Tip|If this menu produces an error, it may be solved by enabling icons in {{ic|~/.config/openbox/rc.xml}}.}}
  
==== GTK1 ====
+
{{AUR|openbox-menu}} uses the [[LXDE]] [http://sourceforge.net/projects/lxde/files/menu-cache/ menu-cache] to create dynamic menus. The [http://fabrice.thiroux.free.fr/openbox-menu_en.html official homepage] provides further information and screenshots.
For legacy GTK1 themes, install the '''gtk-theme-switch''' package:
 
# pacman -S gtk-theme-switch
 
Then run {{Codeline|switch}} to select a desired theme.
 
  
==== GTK fonts ====
+
=== Menu icons ===
  
To manually change the type and size of your fonts, add the following to {{Filename|~/.gtkrc.mine}}:
+
To show icons next to menu entries, it will be necessary to ensure they are enabled in the {{ic|<menu>}} section of the {{ic|~/.config/openbox/rc.xml}} file:
style "user-font"
 
{
 
font_name = "[font-name] [size]"
 
}
 
widget_class "*" style "user-font"
 
gtk-font-name = "[font-name] [size]"
 
  
where {{Codeline|[font-name] [size]}} is the desired font and point size. For example:
+
  <applicationIcons>yes</applicationIcons>
  style "user-font"
 
{
 
font_name = "DejaVu Sans 8"
 
}
 
widget_class "*" style "user-font"
 
gtk-font-name = "DejaVu Sans 8"
 
  
Both {{Codeline|font_name}} and {{Codeline|gtk-font-name}} fields are required for backwards compatibility.
+
Where using a static menu, it will then be necessary to edit the {{ic|~/.config/openbox/menu.xml}} file to provide both the {{ic|icon <nowiki>=</nowiki>}} command, along with the full path and icon name for each entry. An example of the syntax used to provide an icon for a category is:
  
You can also use '''gtk-chtheme''' or '''lxappearance''' to set GTK font settings. Please refer to the above section.
+
<menu id="apps-menu" label="[label name]" icon="[pathway to icon]/[icon name]">
  
==== GTK Icons ====
+
=== Desktop menu as a panel menu ===
  
First, extract the desired icon theme to <tt>/usr/share/icons</tt> (system-wide access) or <tt>~/.icons</tt> (local user access), then:
+
{{Tip|XDoTool can simulate any keybind for any action, and as such, it may therefore be used for many other purposes...}}
  
Add the following to {{Filename|~/.gtkrc.mine}}:  
+
[[xdotool]] is a package that can issue commands to simulate key presses / keybinds, meaning that it is possible to use it to invoke keybind-related actions without having to actually press their assigned keys. As this includes the ability to invoke an assigned keybind for the Openbox desktop menu, it is therefore possible to use XDoTool to turn the Openbox desktop menu into a panel menu. Especially where the desktop menu is heavily customised and feature-rich, this may prove very useful to:
gtk-icon-theme-name = "[name-of-icon-theme]"
 
  
where {{Codeline|[name-of-icon-theme]}} is the name of the icon theme directory. For example:
+
* Replace an existing panel menu
gtk-icon-theme-name = "Tango"
+
* Implement a panel menu where otherwise not provided or possible (e.g. for [[Tint2]])
 +
* Compensate where losing access to the desktop menu due to the use of an application like {{pkg|xfdesktop}} to manage the [[#Desktop icons and wallpapers|desktop]].
  
Ensure {{Filename|~/.gtkrc-2.0}} is configured to parse {{Filename|~/.gtkrc.mine}}:
+
Once XDoTool has been installed - if not already present - it will be necessary to create a keybind to access the root menu in {{ic|~/.config/openbox/rc.xml}}, and again below the {{ic|<nowiki><</nowiki>!-- Keybindings for running aplications --<nowiki>></nowiki>}} heading. For example, the following code will bring up the menu by pressing {{ic|CTRL}} + {{ic|m}}:
  
  # ~/.gtkrc-2.0
+
  <keybind key="C-m">
# -- THEME AUTO-WRITTEN DO NOT EDIT
+
    <action name="ShowMenu">
include "/usr/share/themes/Rezlooks-Gilouche/gtk-2.0/gtkrc"
+
        <menu>root-menu</menu>
  include "/home/username/.gtkrc.mine"
+
    </action>
# -- THEME AUTO-WRITTEN DO NOT EDIT
+
  </keybind>
  
You can use '''lxappearance''' to choose GTK icon themes. Please refer to the above section.
+
Openbox must then be [[#Openbox reconfiguration|reconfigured]]. In this instance, XDoTool will be used to simulate the {{ic|CTRL}} + {{ic|m}} keypress to access the desktop menu with the following command (note the use of {{ic|+}} in place of {{ic|-}}):
  
=== Mouse cursors ===
+
xdotool key control+m
  
Extract the desired Xcursor theme to either <tt>/usr/share/icons</tt> (system-wide access) or <tt>~/.icons</tt> (local user access). There are also a limited amount of themes available in the community repository that can be installed using pacman.
+
How this command may be used as a panel launcher / icon is largely dependent on the features of panel used. While some panels will allow the above command to be executed directly in the process of creating a new launcher, others may require the use of an executable script. As an example, a custom executable script called {{ic|obpanelmenu.sh}} will be created in the {{ic|~/.config}} folder:
  
Add this to {{Filename|~/.Xdefaults}}:
+
$ ''text editor'' ~/.config/obpanelmenu.sh
Xcursor.theme:  [name-of-cursor-theme]
 
where {{Codeline|[name-of-cursor-theme]}} is the name of the cursor theme directory. For example:
 
Xcursor.theme: Vanilla-DMZ-AA
 
To change the size:
 
Xcursor.size: [size]
 
  
=== Desktop icons ===
+
Once the empty file has been opened, the appropriate XDoTool command must be added to the empty file (i.e. to simulate the {{ic|CTRL}} + {{ic|m}} keypress for this example):
Openbox does not provide a means to display icons on the desktop. PcmanFM, [http://rox.sourceforge.net ROX], [http://idesk.sourceforge.net iDesk], or even Nautilus (and the gnome-settings-daemon) can provide this function.
 
  
ROX and PCmanFM have the additional advantage of being lightweight file managers.
+
xdotool key control+m
  
=== Desktop wallpaper ===
+
After the file has been saved and closed, it may then be made into an executable script with the following command:
  
Openbox itself does not include a way to change the wallpaper. This can be done easily with programs like [[Feh]] or [[Nitrogen]].  Other options include ImageMagick, hsetroot and xsetbg.
+
$ chmod +x ~/.config/obpanelmenu.sh
  
== Recommended programs ==
+
Executing it will bring up the Openbox desktop menu. Consequently, where using a panel that supports drag-and-drop functionality to add new launchers, simply drag the executable script onto it before changing the icon to suit personal taste.
  
There is [[Lightweight Applications|list of Lightweight Software]] at Arch's wiki, most of them nicely fits with Openbox.
+
=== XDG compliant menu ===
  
=== Login managers ===
+
A xdg compliant menu is based on the freedesktop.org standard. The menu is defined in menu-files which reside in /etc/xdg/menus. New applications will occur automatically in the menu.
  
[http://slim.berlios.de/ SLiM] provides a lightweight and elegant graphical login solution for standalone Openbox configurations.  Refer to Arch's [[SLiM]] wiki for detailed instructions.
+
==== Examples ====
  
[http://qingy.sourceforge.net/ Qingy] is ultralight and very configurable graphical login. It support login to both console and X Windows sessions. It uses [http://www.directfb.org DirectFB], therefore it does not start X Windows unless you choose X Windows session. See article about [[Qingy]] at Arch's wiki.
+
* [https://github.com/mlde/californium californium]: xdg menu based on the LXQt main menu and easily themable
  
=== Composite desktop ===
+
== Tips and tricks ==
  
[[Xcompmgr]] is a lightweight composite manager capable of rendering drop shadows, fading and simple window transparency within Openbox and other window managers.
+
=== Cursor and icon themes ===
  
(It's worth noting that xcompmgr is no longer developed, and so any issues are unlikely to be fixed)
+
See [[Cursor themes]] and [[Icons]] for details.
  
[http://aur.archlinux.org/packages.php?ID=30042 Cairo Comp Mgr] is an alternative.
+
=== Desktop icons and wallpapers ===
  
=== Panels, trays, and pagers ===
+
Openbox does not natively support the use of desktop icons or wallpapers.
  
There are quite a lot of utilities available that provide a panel (taskbar), system tray, and pager to Openbox. The most common are:
+
See [[PCManFM#Desktop management|PCManFM]], [[SpaceFM#Desktop management|SpaceFM]] and [[Idesk]].
  
==== Panels ====
+
{{note|You may have to edit {{ic|~/.conkyrc}} and set {{ic|own_window_type}} to {{ic|normal}}.}}
* [[PyPanel]]
 
* [http://nsf.110mb.com/bmpanel/ bmpanel]
 
* [[tint2]]
 
* [http://www.gnomefiles.org/app.php/LXPanel LXPanel]
 
* [http://fbpanel.sourceforge.net fbpanel]
 
* [http://perlpanel.org/ PerlPanel]
 
* [http://www.chatjunkies.org/fspanel/ fspanel]
 
* [http://www.xfce.org/projects/xfce4-panel/ xfce4-panel]
 
* [http://developer.gnome.org/arch/gnome/corecomponents/panel/ gnome-panel]
 
* [http://code.google.com/p/avant-window-navigator/ avant-window-navigator]
 
* [http://developer.berlios.de/projects/cairo-dock/ cairo-dock]
 
* [http://code.google.com/p/wbar/ wbar]
 
* [http://www.screenlets.org/ screenlets]
 
  
==== Trays ====
+
See [[List of applications#Wallpaper setters]].
* [http://stalonetray.sourceforge.net/ Stalonetray]
 
* [http://download.gna.org/fvwm-crystal/trayer/1.0/ Trayer]
 
  
==== Pagers ====
+
=== Compositing effects ===
* [http://projects.l3ib.org/trac/visibility Visibility]
 
* [http://bbtools.sourceforge.net/ bbpager]
 
* [http://aur.archlinux.org/packages.php?ID=17563 netwmpager]
 
* [http://useperl.ru/ipager/index.en.html IPager]
 
  
Make your choice and add it to your startup file.
+
Openbox does not provide native support for [[Wikipedia:Compositing window manager|compositing]], and thus requires an external compositor for this purpose.
  
=== File managers ===
+
Although compositing is not a necessary component, it may specifically avoid issues such as screen distortion with [[#oblogout|oblogout]], and visual glitches with terminal window transparency. See [[Xorg#Composite]] for common choices.
  
There are many possibilities, but the most popular lightweight file managers are:
+
=== oblogout ===
* [http://thunar.xfce.org Thunar]. Thunar supports auto-mount features and other plugins.
 
# pacman -S thunar
 
Thunar may be started in daemon mode for tighter desktop integration. For instance, inserting a USB pendrive will invoke a Thunar window to popup, with the drive contents listed in the window.
 
  
To start Thunar in daemon mode, edit {{Filename|~/.config/openbox/autostart.sh}} and add:
+
See the [[Oblogout]] article for an overview on how to use this useful, graphical logout script.
thunar --daemon &
 
  
* [http://rox.sourceforge.net ROX] (ROX provides desktop icons)
+
=== Openbox for multihead users ===
# pacman -S rox
 
* [http://pcmanfm.sourceforge.net PCManFM] (pcmanfm also provides desktop icons)
 
# pacman -S pcmanfm
 
For even lighter options, consider [http://www.obsession.se/gentoo/ Gentoo] or [http://emelfm.sourceforge.net/ emelFM], both of which use the familiar 'Midnight Commander' two pane layout (these two require Gtk 1.2.x).
 
  
Of course, you can also use GNOME's Nautilus. Although slower than the above solutions, it has the additional advantage of VFS support (e.g. remote SSH, FTP and Samba connections)
+
While Openbox provides better than average multihead support on its own, {{AUR|openbox-multihead-git}} provides a development branch called '''Openbox Multihead''' that gives multihead users per-monitor desktops. This model is not commonly found in floating window managers, but exists mainly in [[Window_manager#Types|tiling window managers]]. It is explained well on the [http://xmonad.org/tour.html#workspace Xmonad web site]. Also, please see [https://github.com/BurntSushi/openbox-multihead/blob/multihead/README.MULTIHEAD README.MULTIHEAD] for a more comprehensive description of the new features and configuration options found in Openbox Multihead.
  
=== Application launchers ===
+
Openbox Multihead will function like normal Openbox when only a single head is available.
  
==== dmenu ====
+
A downside to using Openbox Multihead is that it breaks the EWMH assumption that one and only one desktop is visible at any time. Thus, existing pagers will not work well with it. To remedy this, you can install {{AUR|pager-multihead-git}}{{Broken package link|{{aur-mirror|pager-multihead-git}}}} alongside Openbox Multihead. It will work without Openbox Multihead if only one monitor is active.
  
Set-up dmenu as described in the [[dmenu]] wiki article.  Then, add the following entry to the <keyboard> section {{Filename|~/.config/openbox/rc.xml}} to enable a shortcut to launch dmenu:
+
=== Launch a complex command with hotkey ===
    <keybind key="W-space">
 
      <action name="Execute">
 
        <execute>dmenu_run</execute>
 
      </action>
 
    </keybind>
 
  
==== Gmrun ====
+
If you need to execute a complex command, use shell functionality.
  
[http://sourceforge.net/projects/gmrun gmrun] provides an excellent Run dialog box, similar to the Alt+F2 features found in Gnome and KDE:
+
Special character replacement are as follows:
# pacman -S gmrun
 
Add the following entry to the <keyboard> section {{Filename|~/.config/openbox/rc.xml}} to enable Alt+F2 functionality:
 
<keybind key="A-F2">
 
<action name="execute"><execute>gmrun</execute></action>
 
</keybind>
 
  
==== Bashrun ====
+
* {{ic|&}}: &amp;amp;
 +
* {{ic|<}}: &amp;lt;
 +
* {{ic|>}}: &amp;gt;
  
[http://bashrun.sourceforge.net bashrun] provides a different, barebones approach to a run dialog, using a specialized bash session within a small xterm window. It is available in the community repository and can be launched through the Alt+F2 style approach mentioned previously. To make bashrun act more like a traditional run dialog, add the following entry to the <applications> section {{Filename|~/.config/openbox/rc.xml}}:
+
This example will turn off display immediately and lock screen with {{Pkg|slock}}. It was taken from [https://bbs.archlinux.org/viewtopic.php?pid=903057 this thread].
     <application name="bashrun">
+
  <keybind key="W-l">
       <desktop>all</desktop>
+
     <action name="Execute">
      <decor>no</decor>  # switch to yes if you prefer a bordered window
+
       <command>sh -c 'slock &amp;amp; (sleep .5 &amp;amp;&amp;amp; xset dpms force off)'</command>
      <focus>yes</focus>
+
    </action>
      <skip_pager>yes</skip_pager>
+
  </keybind>
      <layer>above</layer>
 
    </application>
 
  
==== Launchy ====
+
Sometimes one need to specify environment variable for application:
 +
  <keybind key="A-F7">
 +
    <action name="Execute">
 +
      <command>sh -c "LC_ALL=C obconf"</command>
 +
    </action>
 +
  </keybind>
  
[http://www.launchy.net/ Launchy] is a less minimalistic approach; it is skinnable and offers more functionality such as a calculator, checking the weather, etc. Originally for Windows, similar to Gnome Do.
+
Another example will launch application preserving all stdout and stderr output to file:
# pacman -S launchy
+
  <keybind key="A-f">
It is launched by Ctrl+Space key combination.
+
    <action name="Execute">
 +
      <command>sh -c sh -c "exec gimp &amp;gt;/tmp/gimp.out 2&amp;gt;&amp;amp;1"</command>
 +
    </action>
 +
  </keybind>
  
==== LXPanel ====
+
Enable screenshot:
 +
  <keybind key="Print">
 +
    <action name="Execute">
 +
      <command>gnome-screenshot -c</command>
 +
    </action>
 +
  </keybind>
 +
  <keybind key="A-Print">
 +
    <action name="Execute">
 +
      <command>gnome-screenshot -c -w</command>
 +
    </action>
 +
  </keybind>
 +
  <keybind key="W-Print">
 +
    <action name="Execute">
 +
      <command>gnome-screenshot -i</command>
 +
    </action>
 +
  </keybind>
  
The LXPanel run dialog can be executed with
+
=== Switch desktops using the mouse ===
lxpanelctl run
 
  
==== gnome-panel ====
+
It is possible to switch desktop by moving the mouse cursor to the edges of the screen. First install {{Pkg|xdotool}} and add the following two lines to your {{ic|~/.xinitrc}}:
  
The gnome-panel run dialog can be executed with
+
xdotool behave_screen_edge --delay 500 left set_desktop --relative -- -1 &
  gnome-panel-control --run-dialog
+
  xdotool behave_screen_edge --delay 500 right set_desktop --relative -- +1 &
  
=== Clipboard managers ===
+
=== Set default applications / file associations ===
  
You may wish to install a clipboard manager for feature rich copy/paste ability. '''xfce4-clipman-plugin, parcellite,''' or '''glipper-old''' may be installed via pacman. Add your choice to autostart.sh. From the terminal, Ctrl+Insert as copy and Shift+Insert as paste generally works as well. You may also copy from terminal with Ctrl+Shift+C, and paste with mouse middle click.
+
See the [[Default applications]] article.
  
=== RSS-Reader ===
+
=== Ad-hoc window transparency ===
* [http://primo-nordica.net/dezza/fasterfeeder.py FasterFeeder RSS Reader for Openbox]
 
  
== Tips and tricks ==
+
{{Warning|This may not work where other actions are defined within the action group.}}
 +
The program {{Pkg|transset-df}} can enable window transparency on-the-fly.
  
=== Copy and paste ===
+
For example, using the following code in the {{ic|<mouse>}} section of the {{ic|~/.config/openbox/rc.xml}} file will enable control of application window transparency by hovering the mouse-pointer over the title bar and scrolling with the middle button:
  
From the terminal, Ctrl+Insert as copy and Shift+Insert as paste generally works as well. You may also copy from terminal with Ctrl+Shift+C, and paste with mouse middle click.
+
<context name="Titlebar">
 +
    ...
 +
    <mousebind button="Up" action="Click">
 +
        <action name= "Execute" >
 +
        <execute>transset-df -p .2 --inc  </execute>
 +
        </action>
 +
    </mousebind>
 +
    <mousebind button="Down" action="Click">
 +
        <action name= "Execute" >
 +
        <execute>transset-df -p .2 --dec </execute>
 +
        </action>
 +
    </mousebind>
 +
    ...
 +
</context>
  
=== Transparency ===
+
=== Using obxprop for faster configuration ===
  
By using the program transset-df, it is virtually the same as [[transset]], (available by: pacman -S transset-df) you can enable transparancy of windows on the fly. For instance by editing the following in {{Filename|~/.config/openbox/rc.xml}} you can have your middle mouse scroll enable and disable transparency by scrolling down and up on the scroll button, respectively, while over the title bar (it is in the <mouse> section):
+
The {{Pkg|openbox}} package provides a {{ic|obxprop}} binary that can parse relevant values for applications settings in {{ic|rc.xml}}. Officially {{ic|<nowiki>obxprop | grep "^_OB_APP"</nowiki>}} is recommended for this task. Start the process by running the command shown, then click a window to see its properties in the terminal.
    <context name="Titlebar">
 
      <mousebind button="Left" action="Press">
 
        <action name="Focus"/>
 
        <action name="Raise"/>
 
      </mousebind>
 
      <mousebind button="Left" action="Drag">
 
        <action name="Move"/>
 
      </mousebind>
 
      <mousebind button="Left" action="DoubleClick">
 
        <action name="ToggleMaximizeFull"/>
 
      </mousebind>
 
      <mousebind button="Middle" action="Press">
 
      <action name="Lower"/>
 
        <action name="FocusToBottom"/>
 
        <action name="Unfocus"/>
 
      </mousebind>
 
      <mousebind button="Up" action="Click">
 
        <action name= "Execute" >
 
        <execute>transset-df -p .2 --inc  </execute>
 
        </action>
 
      </mousebind>
 
      <mousebind button="Down" action="Click">
 
        <action name= "Execute" >
 
        <execute>transset-df -p .2 --dec </execute>
 
        </action>
 
      </mousebind>
 
      <mousebind button="Right" action="Press">
 
        <action name="Focus"/>
 
        <action name="Raise"/>
 
        <action name="ShowMenu">
 
          <menu>client-menu</menu>
 
        </action>
 
      </mousebind>
 
    </context>
 
As of now, it only appears to work when no other actions are taken.
 
  
 
=== Xprop values for applications ===
 
=== Xprop values for applications ===
If you use per-application settings frequently, you might find this bash alias handy:
+
 
 +
{{Pkg|xorg-xprop}} can be used to relay property values for selected applications. Where frequently using per-application settings, the following [[Bash#Aliases|Bash Alias]] may be useful:
  
 
  alias xp='xprop | grep "WM_WINDOW_ROLE\|WM_CLASS" && echo "WM_CLASS(STRING) = \"NAME\", \"CLASS\""'
 
  alias xp='xprop | grep "WM_WINDOW_ROLE\|WM_CLASS" && echo "WM_CLASS(STRING) = \"NAME\", \"CLASS\""'
  
To use, run '''{{Codeline|xp}}''' and click on the running program that you'd like to define with per-app settings. The result will display only the info that Openbox requires, namely the WM_WINDOW_ROLE and WM_CLASS (name and class) values:
+
To use Xorg-XProp, run using the alias given {{ic|xp}}, and click on the active program desired to define with per-application settings. The results displayed will only be the information that Openbox itself requires, namely the {{ic|WM_WINDOW_ROLE}} and {{ic|WM_CLASS}} (name and class) values:
  
[thayer@dublin:~] $ xp
 
 
  WM_WINDOW_ROLE(STRING) = "roster"
 
  WM_WINDOW_ROLE(STRING) = "roster"
 
  WM_CLASS(STRING) = "gajim.py", "Gajim.py"
 
  WM_CLASS(STRING) = "gajim.py", "Gajim.py"
 
  WM_CLASS(STRING) = "NAME", "CLASS"
 
  WM_CLASS(STRING) = "NAME", "CLASS"
  
==== Xprop for Firefox ====
+
=== Switching between keyboard layouts ===
 +
 
 +
See the article section [[Keyboard configuration in Xorg#Switching between keyboard layouts|switching between keyboard layouts]] for instructions.
 +
 
 +
=== Set grid layout for virtual desktops ===
 +
 
 +
Install {{AUR|obsetlayout}}. To set a 2x2 grid for example:
 +
 
 +
obsetlayout 0 2 2 0
 +
 
 +
Run it without arguments to know what the arguments mean.
 +
 
 +
=== Enable Hot Corners ===
 +
 
 +
[https://github.com/mlde/lead lead] provides hot corners for openbox and other lightweight window managers. Start the application with a entry in the autostart-file:
 +
 
 +
mlde.lead &
 +
 
 +
Commands can be edited in the configuration file {{ic|~/.config/mlde/lead.conf}}:
 +
 
 +
[eDP1]
 +
bottom=
 +
bottomLeft=chromium
 +
bottomRight=thunar
 +
left=
 +
right=
 +
top=
 +
topLeft=mlde.californium toggle
 +
topRight=skippy-xd
 +
 
 +
=== Window snapping ===
 +
 
 +
Many desktop environments and window managers support ''window snapping'' (e.g. Windows 7 Aero snap), whereby they will automatically snap into place when moved to the edge of the screen. This effect can also be simulated in Openbox through the use of [[#Keybinds|keybinds]] on focused windows.
 +
 
 +
As illustrated in the example below, percentages must be used to determine window sizes (see [http://openbox.org/wiki/Help:Actions openbox.org] for further information). In this instance, The {{ic|super}} key is used in conjunction with the {{ic|navigation}} keys:
 +
 
 +
<keybind key="W-Left">
 +
    <action name="UnmaximizeFull"/>
 +
    <action name="MaximizeVert"/>
 +
    <action name="MoveResizeTo">
 +
        <width>50%</width>
 +
    </action>
 +
    <action name="MoveToEdge"><direction>west</direction></action>
 +
</keybind>
 +
<keybind key="W-Right">
 +
    <action name="UnmaximizeFull"/>
 +
    <action name="MaximizeVert"/>
 +
    <action name="MoveResizeTo">
 +
        <width>50%</width>
 +
    </action>
 +
    <action name="MoveToEdge"><direction>east</direction></action>
 +
</keybind>
 +
 
 +
However, it should be noted that once a window has been 'snapped' to an edge, it will remain vertically maximised unless subsequently maximised and then restored. The solution is to implement additional keybinds - in this instance using the {{ic|down}} and {{ic|up}} keys - to do so. This will also make pulling 'snapped' windows from screen edges faster as well:
 +
 
 +
<keybind key="W-Down">
 +
    <action name="Unmaximize"/>
 +
</keybind>
 +
<keybind key="W-Up">
 +
    <action name="Maximize"/>
 +
</keybind>
 +
 
 +
This [http://ubuntuforums.org/showthread.php?t=1796793 Ubuntu forum thread] provides more information. Applications such as {{AUR|opensnap}} are also available to automatically simulate window snapping behaviour without the use of keybinds.
 +
Another option is to use {{AUR|bunsen-utilities-git}} which provides {{ic|bl-aerosnap --left}} and {{ic|bl-aerosnap --right}} commands which will snap active window on left or right edge respectively if it's not snapped and restore it to original size and position otherwise. Just bind these commands to the key combination of your choosing.
 +
 
 +
=== Smooth display manager transition ===
 +
 
 +
{{Note|This has been confirmed to work with [[LightDM]].}}
 +
 
 +
Users of display managers might experience a flickering during the transition between the display manager and the Openbox desktop. The flickering comes from Openbox setting the root window's color during startup. Therefore there's a brief moment when the display flashes in a grey color, between the display manager's background and the desktop's wallpaper.
 +
 
 +
Setting the root window's background color can be disabled by editing the Openbox startup script found in {{ic|/usr/lib/openbox/openbox-autostart}}. Simply comment out (or delete) the block starting with {{ic|# Set a background color}}.
 +
 
 +
{{Note|Users who don't specifically set their wallpaper will "inherit" the display manager's background automatically if they disable the root window color adjustment.}}
 +
 
 +
=== Window Decorations ===
 +
 
 +
To remove window decorations for all or particular applications, use the ''<decor>'' option in the ''<applications>'' section of ''rc.xml'' (user: ''~/.config/openbox/'' or system: ''/etc/xdg/openbox/'').<br>
 +
Example for Firefox, including variants like Firefox-Beta and Firefox-Nightly:
 +
  <application class="Firefox*">
 +
    <decor>no</decor>
 +
  </application>
 +
One could also disable decorations for all applications (using class '''"*"'''), then enable them (using '''yes''') for individual ones. To apply the changes, restart your desktop session, and thus Openbox. Reference: [http://openbox.org/wiki/Help:FAQ#How_do_I_remove_the_decorations_from_all_my_windows.3F Openbox FAQ]
 +
 
 +
== Troubleshooting ==
  
For whatever reason, Firefox and its open source equivalents will ignore application rules (e.g. <desktop>) unless {{Codeline|class&#61;"Firefox*"}} is used, regardless of what xprop reports as the actual WM_CLASS values.
+
=== Firefox ===
  
=== Linking the menu to a command ===
+
Mozilla based browsers may ignore application rules (e.g. {{ic|<desktop>}}) unless {{ic|1=class="Firefox"}} is used. See [[#Xprop values for applications]].
  
Some people would want to link the Openbox main menu, or any other, to a command. This is useful for creating a menu button in a panel, for example. Although Openbox doesn't support this, a very simple script, xdotool, can simulate a keypress by running a command. Xdotool is [http://aur.archlinux.org/packages.php?do_Details=1&ID=14789&O=0&L=0&C=0&K=xdotool&SB=n&SO=a&PP=25&do_MyPackages=0&do_Orphans=0&SeB=nd available on AUR]. To use it, simply add the following code to the <keyboard> section of your {{Filename|rc.xml}}:
+
=== Missing themes ===
    <keybind key="A-C-q">
 
      <action name="ShowMenu">
 
        <menu>root-menu</menu>
 
      </action>
 
    </keybind>
 
Restart/reconfigure Openbox. You can now magically summon your menu at your cursor position by running the following command:
 
# xdotool key ctrl+alt+q
 
Of course, you can change the shortcut to your liking.
 
  
=== Urxvt in the background ===
+
If for any reason the newly extracted theme cannot be selected, open the theme directory to first ensure that it is compatible with Openbox - there should be an {{ic|openbox-3}} directory and a {{ic|themerc}} file within it. An {{ic|.obt}} ('''O'''pen'''B'''ox '''T'''heme) file may also be present in some instances, which can then be manually loaded in {{Pkg|obconf}}.
  
With Openbox, running a terminal as desktop background is easy. You won't need '''devilspie''' here.
+
A theme may also be not accessible due to wrong permissions. See [[File permissions and attributes]] for more.
 +
 
 +
=== Stop continuous desktop switching ===
 +
 
 +
By default Openbox switches from the last desktop back to the first desktop on mouse wheel scroll. Use {{ic|<wrap>no</wrap>}} in the {{ic|mousebind}} section to disable this behaviour.
 +
 
 +
    <context name="Desktop">
 +
      <mousebind button="Up" action="Click">
 +
        <action name="GoToDesktop">
 +
          <to>previous</to>
 +
          <wrap>no</wrap>
 +
        </action>
 +
      </mousebind>
 +
      <mousebind button="Down" action="Click">
 +
        <action name="GoToDesktop">
 +
          <to>next</to>
 +
          <wrap>no</wrap>
 +
        </action>
 +
      </mousebind>
 +
    </context>
  
First you must enable transparency, open your {{Filename|.Xdefaults}} file (if it doesn't exist yet, create it in your home folder).
+
=== Windows load behind the active window ===
URxvt*transparent:true
 
URxvt*scrollBar:false
 
URxvt*geometry:124x24    #I don't use the whole screen, if you want a full screen term don't bother with this and see below.
 
URxvt*borderLess:true
 
URxvt*foreground:Black  #Font color. My wallpaper is White, you may wish to change this to White.
 
  
Then edit your {{Filename|.config/openbox/rc.xml}} file:
+
Some application windows (such as Firefox windows) may load behind the currently active window, causing you to need to switch to the window you just created to focus it. To fix this behavior add this to your {{ic|~/.config/openbox/rc.xml}} file, inbetween the {{ic|1=<openbox_config>}} and {{ic|1=</openbox_config>}} tags:
<application name="urxvt">
 
  <decor>no</decor>
 
  <focus>yes</focus>
 
  <position>
 
    <x>center</x>
 
    <y>20</y>
 
  </position>
 
  <layer>below</layer>
 
  <desktop>all</desktop>
 
  <maximized>true</maximized> #Only if you want a full size terminal.
 
</application>
 
  
The ''magic'' comes from the {{Codeline|<layer>below</layer>}} line, which place the application under all others. Here Urxvt is displayed on all desktops, change it to your convenience.
+
{{bc|1=
 +
<applications>
 +
  <application class="*">
 +
    <focus>yes</focus>
 +
  </application>
 +
</applications>
 +
}}
  
== Resources ==
+
== See also ==
  
* [http://openbox.org/ Openbox Website] &ndash; The official website
+
* [http://openbox.org/ Openbox Website] - Official website
* [http://planetob.openmonkey.com/ Planet Openbox] &ndash; Openbox news portal
+
* [http://www.box-look.org/ Box-Look.org] - A good resource for themes and related artwork
* [http://www.box-look.org/ Box-Look.org] &ndash; A good resource for themes and related artwork
+
* [https://bbs.archlinux.org/viewtopic.php?id=93126 Openbox Hacks and Configs Thread] @ Arch Linux Forums
<!-- vim: set ft=Wikipedia: -->
+
* [https://bbs.archlinux.org/viewtopic.php?id=45692 Openbox Screenshots Thread] @ Arch Linux Forums
 +
* [http://urukrama.wordpress.com/openbox-guide/ An Openbox guide]

Latest revision as of 16:15, 15 August 2019

Openbox is a lightweight, powerful, and highly configurable stacking window manager with extensive standards support. It may be built upon and run independently as the basis of a unique desktop environment, or within other integrated desktop environments such as KDE and Xfce, as an alternative to the window managers they provide. The LXDE desktop environment is itself built around Openbox.

Installation

Install the openbox package.

Starting

Standalone

Run openbox or openbox-session with xinit. Note that only openbox-session provides #Autostart.

Note: After executing openbox-session, there is only a blank grey screen. Try to move your mouse and right click to get an openbox menu to make sure that it is actually working.

Other desktop environments

Note:

See Desktop environment#Use a different window manager.

Configuration

Note: Local configuration files will always override global equivalents.

Four key files form the basis of the openbox configuration, each serving a unique role. They are: rc.xml, menu.xml, autostart, and environment. Although these files are discussed in more detail below, to start configuring Openbox, it will first be necessary to create a local Openbox profile (i.e for your specific user account) based on them. This can be done by copying them from the global /etc/xdg/openbox profile (applicable to any and all users) as a template:

$ mkdir -p ~/.config/openbox
$ cp -a /etc/xdg/openbox/. ~/.config/openbox/

rc.xml

Tip: Custom keyboard shortcuts (keybindings) must be added to the <keyboard> section of this file, and underneath the <!-- Keybindings for running aplications --> heading.

~/.config/openbox/rc.xml is the main configuration file, responsible for determining the behaviour and settings of the overall session, including:

  • Keyboard shortcuts (e.g. starting applications; controlling the volume)
  • Theming
  • Desktop and Virtual desktop settings, and
  • Application Window settings

This file is also pre-configured, meaning that it will only be necessary to amend existing content in order to customise behaviour to suit personal preference.

Note: Per-application settings pertaining to fixed placement of applications per monitor will only work if the x & y position have also been defined.

menu.xml

~/.config/openbox/menu.xml defines the type and behaviour of the desktop menu, accessible by right-clicking the background. Although the default provided is a static menu (meaning that it will not automatically update when new applications are installed), it is possible to employ the use of dynamic menus that will automatically update as well.

The available options are discussed extensively below in the #Menus section.

Autostart

openbox-session provides two autostart mechanisms: XDG Autostart (which only works if python2-xdg is installed) and Openbox's own autostart mechanism.

Openbox's own autostart mechanism:

  • sources /etc/xdg/openbox/environment
  • sources ~/.config/openbox/environment
  • runs /etc/xdg/openbox/autostart
  • runs ~/.config/openbox/autostart

Issues regarding commands in ~/.config/openbox/autostart being executed out of order (or skipped altogether) are often resolved by the addition of small delays. For instance:

xset -b
(sleep 3s && nm-applet) &
(sleep 3s && conky) &

environment

~/.config/openbox/environment can be used to export and set relevant environmental variables such as to:

  • Define new pathways (e.g. execute commands that would otherwise require the entire pathway to be listed with them)
  • Change language settings, and
  • Define other variables to be used (e.g. the fix for GTK theming could be listed here)

Themes

Install obconf and/or lxappearance-obconf for a GUI to configure visual settings and theming.

A good selection of themes are available in the openbox-themesAUR package or the AUR. Some GTK#Themes come with an Openbox theme as well. Both Openbox-specific and Openbox-compatible themes will be installed to the /usr/share/themes directory and will also be immediately available for selection.

box-look.org is an excellent and well-established source of themes. deviantART.com is another excellent resource. Many more can be found online.

Edit or create

Tip: It's better to copy a theme to your home directory than to edit those found in /usr/share/themes/. This will retain the original should anything go wrong and ensure that your changes are not overwritten on update.

The process of creating new or modifying existing themes is covered extensively at the official openbox.org website. obthemeAUR is a user-friendly GUI for doing so.

GUI configuration

Several GUI applications are available to quickly and easily configure your Openbox desktop.

  • ObConf — A GTK2 based configuration tool for the Openbox window manager.
http://openbox.org/wiki/ObConf:About || obconf
  • LXAppearance ObConf — Plugin for LXAppearance to configure Openbox. Note that not all options to configure Openbox are available in this plugin, so you might want to install obconf anyway.
http://lxde.org || lxappearance-obconf
  • LXInput — LXDE keyboard and mouse configuration
http://lxde.org || lxinput
  • LXRandR — LXDE monitor configuration.
http://wiki.lxde.org/en/LXRandR || lxrandr
  • obkey — Configure Openbox keyboard shortcuts
https://code.google.com/p/obkey/ || obkeyAUR
  • ob-autostart — A simple autostart application for Openbox.
http://pastebin.com/012YgXTk || ob-autostartAUR
  • obapps — Graphical tool for configuring application settings in Openbox.
https://sourceforge.net/projects/obapps/ || obappsAUR

Programs and applications relating to the configuration of Openbox's desktop menu are discussed in the Menus section.

Openbox reconfiguration

Tip: where not already present, it would be worthwhile adding this command to a menu and/or as a keybind for convenience.

Openbox will not always automatically reflect any changes made to its configuration files within a session. As a consequence, it will be necessary to manually reload those files after they have been edited. To do so, enter the following command:

$ openbox --reconfigure

Where intending to add this command as a keybind to ~/.config/openbox/rc.xml, it will only be necessary to list the command as reconfigure. An example has been provided below, using the Super+F11 keybind:

<keybind key="W-F11">
  <action name="Reconfigure"/>
</keybind>

Keybinds

All keybinds must be added to the ~/.config/openbox/rc.xml file, and below the <!-- Keybindings for running aplications --> heading. Although a brief overview has been provided here, a more in-depth explanation of keybindings can be found at openbox.org.

Keybinds can be added to the configuration file using the following syntax:

<keybind key="my-key-combination">
  <action name="my-action">
    ...
  </action>
</keybind>

The action name for running an external command is Execute. Use the following syntax to define an external command to execute:

<action name="Execute">
  <command>my-command</command>
</action>

See the Openbox wiki for a list of all available actions.

Tip: The obkeyAUR utility provides a graphical interface for configuring key bindings. Before using obkey, you should use obconf to create ~/.config/openbox/rc.xml.

While the use of standard alpha-numeric keys for keybindings is self-explanatory, special names are assigned to other types of keys, such as modifiers, multimedia and navigation.

Modifiers

Modifier keys play an important role in keybindings (e.g. holding down the shift or CTRL / control key in combination with another key to undertake an action). Using modifiers helps to prevent conflicting keybinds, whereby two or more actions are linked to the same key or combination of keys. The syntax to use a modifier with another key is:

"<modifier>-<key>"

The modifier codes are as follows:

  • S: Shift
  • C: Control / CTRL
  • A: Alt
  • W: Super / Windows
  • M: Meta
  • H: Hyper (If it is bound to something)

Multimedia keys

Where available, it is possible to set the appropriate multimedia keys to perform their intended functions, such as to control the volume and/or the screen brightness. These will usually be integrated into the function keys, and are identified by their appropriate symbols. See Extra keyboard keys for details.

The volume and brightness multimedia codes are as follows (note that commands will still have to be assigned to them to actually function):

  • XF86AudioRaiseVolume: Increase volume
  • XF86AudioLowerVolume: Decrease volume
  • XF86AudioMute: Mute / unmute volume
  • XF86MonBrightnessUp: Increase screen brightness
  • XF86MonBrightnessDown: Decrease screen brightness

For a full list of XF86 multimedia keys, see the LinuxQuestions wiki.

Volume control

What commands should be used for controlling the volume will depend on whether ALSA, PulseAudio, or OSS is used for sound.

Navigation keys

These are the directional / arrow keys, usually used to move the cursor up, down, left, or right. The (self-explanatory) navigation codes are as follows:

  • Up: Up
  • Down: Down
  • Left: Left
  • Right: Right

Menus

It is possible to employ three types of menu in Openbox: static, pipes (dynamic), and generators (static or dynamic). They may also be used alone or in any combination.

Static

As the name would suggest, this default type of menu does not change in any way, and may be manually edited and/or (re)generated automatically through the use on an appropriate software package.

Fast and efficient, while this type of menu can be used to select applications, it can also be useful to access specific functions and/or perform specific tasks (e.g. desktop configuration), leaving the access of applications to another process (e.g. the synapse or xfce4-appfinder applications).

The ~/.config/openbox/menu.xml file will be the sole source of static desktop menu content.

menumaker

menumaker automatically generates xml menus for several window managers, including Openbox, Fluxbox, IceWM and Xfce. It will search for all installed executable programs and consequently create a menu file for them. It is also possible to configure MenuMaker to exclude certain application types (e.g. relating to GNOME or KDE), if desired.

Once installed and executed, it will automatically generate a new ~/.config/openbox/menu.xml file. To avoid overwriting an existing file, enter:

$ mmaker -v OpenBox3

Otherwise, to overwrite an existing file, add the force argument (f):

$ mmaker -vf OpenBox3

Once a new ~/.config/openbox/menu.xml file has been generated it may then be manually edited, or configured using a GUI menu editor, such as obmenuAUR.

obmenu

Warning: obm-xdg - a pipe menu to generate a list of GTK and GNOME applications - is also provided with obmenu. However, it has long-running bugs whereby it may produce an invalid output, or even not function at all. Consequently it has been omitted from discussion.

obmenuAUR is a "user-friendly" GUI application to edit ~/.config/openbox/menu.xml, without the need to code in xml.

xdg-menu

archlinux-xdg-menu will automatically generate a menu based on xdg files contained within the /etc/xdg/ directory for numerous Window Managers, including Openbox. Review the Xdg-menu#OpenBox article for further information.

logout menu options

Tip: The commands provided can also be attached to keybinds.

The ~/.config/openbox/menu.xml file can be edited in order to provide a sub-menu with the same options as provided by oblogout. The sample script below will provide all of these options, with the exception of the ability to lock the screen:

<menu id="exit-menu" label="Exit">
	<item label="Log Out">
		<action name="Execute">
			<command>openbox --exit</command>
		</action>
	</item>
	<item label="Shutdown">
		<action name="Execute">
			<command>systemctl poweroff</command>
		</action>
	</item>
	<item label="Restart">
		<action name="Execute">
		        <command>systemctl reboot</command>
		</action>
	</item>
	<item label="Suspend">
		<action name="Execute">
		        <command>systemctl suspend</command>
		</action>
	</item>
	<item label="Hibernate">
		<action name="Execute">
		        <command>systemctl hibernate</command>
		</action>
	</item>
</menu>

Once the entries have been composed, add the following line to present the sub-menu where desired within the main desktop menu (usually as the last entry):

<menu id="exit-menu"/>

Pipes

Tip: It is entirely feasible for a static menu to contain one or more pipe sub-menus. The functionality of some pipe menus may also rely on the installation of relevant software packages.

This type of menu is in essence a script that provides dynamic, refreshed lists on-the-fly as and when run. These lists may be used for multiple purposes, including to list applications, to provide information, and to provide control functions. Pre-configured pipe menus can be installed, although not from the official repositories. More experienced users can also modify and/or create their own custom scripts. Again, ~/.config/openbox/menu.xml may and commonly will contain several pipe menus.

Examples

Openbox.org also provides a further list of pipe menus.

Generators

This type of menu is akin to those provided by the taskbars of desktop environments such as Xfce or LXDE. Automatically updating on-the-fly, this type of menu can be powerful and very convenient. It may also be possible to add custom categories and menu entries; read the documentation for your intended dynamic menu to determine if and how this can be done.

A menu generator will have to be executed from the ~/.config/openbox/menu.xml file.

obmenu-generator

Tip: icons can still be disabled in obmenu-generatorAUR, even where enabled in ~/.config/openbox/rc.xml.

obmenu-generatorAUR is highly recommended despite being an unofficial package. With the ability to be used as a static or dynamic menu, it is highly configurable, powerful, and versatile. Menu categories and individual entries may also be easily hidden, customised, and/or added with ease. The official homepage provides further information and screenshots.

Below is an example of how obmenu-generator would be dynamically executed without icons in ~/.config/openbox/menu.xml:

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu>
    <menu id="root-menu" label="OpenBox 3" execute="/usr/bin/obmenu-generator">
    </menu>
</openbox_menu>

To automatically iconify entries, the -i option would be added:

<menu id="root-menu" label="OpenBox 3" execute="/usr/bin/obmenu-generator -i">

openbox-menu

Tip: If this menu produces an error, it may be solved by enabling icons in ~/.config/openbox/rc.xml.

openbox-menuAUR uses the LXDE menu-cache to create dynamic menus. The official homepage provides further information and screenshots.

Menu icons

To show icons next to menu entries, it will be necessary to ensure they are enabled in the <menu> section of the ~/.config/openbox/rc.xml file:

<applicationIcons>yes</applicationIcons>

Where using a static menu, it will then be necessary to edit the ~/.config/openbox/menu.xml file to provide both the icon = command, along with the full path and icon name for each entry. An example of the syntax used to provide an icon for a category is:

<menu id="apps-menu" label="[label name]" icon="[pathway to icon]/[icon name]">

Desktop menu as a panel menu

Tip: XDoTool can simulate any keybind for any action, and as such, it may therefore be used for many other purposes...

xdotool is a package that can issue commands to simulate key presses / keybinds, meaning that it is possible to use it to invoke keybind-related actions without having to actually press their assigned keys. As this includes the ability to invoke an assigned keybind for the Openbox desktop menu, it is therefore possible to use XDoTool to turn the Openbox desktop menu into a panel menu. Especially where the desktop menu is heavily customised and feature-rich, this may prove very useful to:

  • Replace an existing panel menu
  • Implement a panel menu where otherwise not provided or possible (e.g. for Tint2)
  • Compensate where losing access to the desktop menu due to the use of an application like xfdesktop to manage the desktop.

Once XDoTool has been installed - if not already present - it will be necessary to create a keybind to access the root menu in ~/.config/openbox/rc.xml, and again below the <!-- Keybindings for running aplications --> heading. For example, the following code will bring up the menu by pressing CTRL + m:

<keybind key="C-m">
    <action name="ShowMenu">
       <menu>root-menu</menu>
    </action>
</keybind>

Openbox must then be reconfigured. In this instance, XDoTool will be used to simulate the CTRL + m keypress to access the desktop menu with the following command (note the use of + in place of -):

xdotool key control+m

How this command may be used as a panel launcher / icon is largely dependent on the features of panel used. While some panels will allow the above command to be executed directly in the process of creating a new launcher, others may require the use of an executable script. As an example, a custom executable script called obpanelmenu.sh will be created in the ~/.config folder:

$ text editor ~/.config/obpanelmenu.sh

Once the empty file has been opened, the appropriate XDoTool command must be added to the empty file (i.e. to simulate the CTRL + m keypress for this example):

xdotool key control+m

After the file has been saved and closed, it may then be made into an executable script with the following command:

$ chmod +x ~/.config/obpanelmenu.sh

Executing it will bring up the Openbox desktop menu. Consequently, where using a panel that supports drag-and-drop functionality to add new launchers, simply drag the executable script onto it before changing the icon to suit personal taste.

XDG compliant menu

A xdg compliant menu is based on the freedesktop.org standard. The menu is defined in menu-files which reside in /etc/xdg/menus. New applications will occur automatically in the menu.

Examples

  • californium: xdg menu based on the LXQt main menu and easily themable

Tips and tricks

Cursor and icon themes

See Cursor themes and Icons for details.

Desktop icons and wallpapers

Openbox does not natively support the use of desktop icons or wallpapers.

See PCManFM, SpaceFM and Idesk.

Note: You may have to edit ~/.conkyrc and set own_window_type to normal.

See List of applications#Wallpaper setters.

Compositing effects

Openbox does not provide native support for compositing, and thus requires an external compositor for this purpose.

Although compositing is not a necessary component, it may specifically avoid issues such as screen distortion with oblogout, and visual glitches with terminal window transparency. See Xorg#Composite for common choices.

oblogout

See the Oblogout article for an overview on how to use this useful, graphical logout script.

Openbox for multihead users

While Openbox provides better than average multihead support on its own, openbox-multihead-gitAUR provides a development branch called Openbox Multihead that gives multihead users per-monitor desktops. This model is not commonly found in floating window managers, but exists mainly in tiling window managers. It is explained well on the Xmonad web site. Also, please see README.MULTIHEAD for a more comprehensive description of the new features and configuration options found in Openbox Multihead.

Openbox Multihead will function like normal Openbox when only a single head is available.

A downside to using Openbox Multihead is that it breaks the EWMH assumption that one and only one desktop is visible at any time. Thus, existing pagers will not work well with it. To remedy this, you can install pager-multihead-gitAUR[broken link: archived in aur-mirror] alongside Openbox Multihead. It will work without Openbox Multihead if only one monitor is active.

Launch a complex command with hotkey

If you need to execute a complex command, use shell functionality.

Special character replacement are as follows:

  • &: &amp;
  • <: &lt;
  • >: &gt;

This example will turn off display immediately and lock screen with slock. It was taken from this thread.

 <keybind key="W-l">
   <action name="Execute">
     <command>sh -c 'slock &amp; (sleep .5 &amp;&amp; xset dpms force off)'</command>
   </action>
 </keybind>

Sometimes one need to specify environment variable for application:

 <keybind key="A-F7">
   <action name="Execute">
     <command>sh -c "LC_ALL=C obconf"</command>
   </action>
 </keybind>

Another example will launch application preserving all stdout and stderr output to file:

 <keybind key="A-f">
   <action name="Execute">
     <command>sh -c sh -c "exec gimp &gt;/tmp/gimp.out 2&gt;&amp;1"</command>
   </action>
 </keybind>

Enable screenshot:

 <keybind key="Print">
   <action name="Execute">
     <command>gnome-screenshot -c</command>
   </action>
 </keybind>
 <keybind key="A-Print">
   <action name="Execute">
     <command>gnome-screenshot -c -w</command>
   </action>
 </keybind>
 <keybind key="W-Print">
   <action name="Execute">
     <command>gnome-screenshot -i</command>
   </action>
 </keybind>

Switch desktops using the mouse

It is possible to switch desktop by moving the mouse cursor to the edges of the screen. First install xdotool and add the following two lines to your ~/.xinitrc:

xdotool behave_screen_edge --delay 500 left set_desktop --relative -- -1 &
xdotool behave_screen_edge --delay 500 right set_desktop --relative -- +1 &

Set default applications / file associations

See the Default applications article.

Ad-hoc window transparency

Warning: This may not work where other actions are defined within the action group.

The program transset-df can enable window transparency on-the-fly.

For example, using the following code in the <mouse> section of the ~/.config/openbox/rc.xml file will enable control of application window transparency by hovering the mouse-pointer over the title bar and scrolling with the middle button:

<context name="Titlebar">
    ...
    <mousebind button="Up" action="Click">
        <action name= "Execute" >
        <execute>transset-df -p .2 --inc  </execute>
        </action>
    </mousebind>
    <mousebind button="Down" action="Click">
        <action name= "Execute" >
        <execute>transset-df -p .2 --dec </execute>
        </action>
    </mousebind>
    ...
</context>

Using obxprop for faster configuration

The openbox package provides a obxprop binary that can parse relevant values for applications settings in rc.xml. Officially obxprop | grep "^_OB_APP" is recommended for this task. Start the process by running the command shown, then click a window to see its properties in the terminal.

Xprop values for applications

xorg-xprop can be used to relay property values for selected applications. Where frequently using per-application settings, the following Bash Alias may be useful:

alias xp='xprop | grep "WM_WINDOW_ROLE\|WM_CLASS" && echo "WM_CLASS(STRING) = \"NAME\", \"CLASS\""'

To use Xorg-XProp, run using the alias given xp, and click on the active program desired to define with per-application settings. The results displayed will only be the information that Openbox itself requires, namely the WM_WINDOW_ROLE and WM_CLASS (name and class) values:

WM_WINDOW_ROLE(STRING) = "roster"
WM_CLASS(STRING) = "gajim.py", "Gajim.py"
WM_CLASS(STRING) = "NAME", "CLASS"

Switching between keyboard layouts

See the article section switching between keyboard layouts for instructions.

Set grid layout for virtual desktops

Install obsetlayoutAUR. To set a 2x2 grid for example:

obsetlayout 0 2 2 0

Run it without arguments to know what the arguments mean.

Enable Hot Corners

lead provides hot corners for openbox and other lightweight window managers. Start the application with a entry in the autostart-file:

mlde.lead &

Commands can be edited in the configuration file ~/.config/mlde/lead.conf:

[eDP1]
bottom=
bottomLeft=chromium
bottomRight=thunar
left=
right=
top=
topLeft=mlde.californium toggle
topRight=skippy-xd

Window snapping

Many desktop environments and window managers support window snapping (e.g. Windows 7 Aero snap), whereby they will automatically snap into place when moved to the edge of the screen. This effect can also be simulated in Openbox through the use of keybinds on focused windows.

As illustrated in the example below, percentages must be used to determine window sizes (see openbox.org for further information). In this instance, The super key is used in conjunction with the navigation keys:

<keybind key="W-Left">
    <action name="UnmaximizeFull"/>
    <action name="MaximizeVert"/>
    <action name="MoveResizeTo">
        <width>50%</width>
    </action>
    <action name="MoveToEdge"><direction>west</direction></action>
</keybind>
<keybind key="W-Right">
    <action name="UnmaximizeFull"/>
    <action name="MaximizeVert"/>
    <action name="MoveResizeTo">
        <width>50%</width>
    </action>
    <action name="MoveToEdge"><direction>east</direction></action>
</keybind>

However, it should be noted that once a window has been 'snapped' to an edge, it will remain vertically maximised unless subsequently maximised and then restored. The solution is to implement additional keybinds - in this instance using the down and up keys - to do so. This will also make pulling 'snapped' windows from screen edges faster as well:

<keybind key="W-Down">
   <action name="Unmaximize"/>
</keybind>
<keybind key="W-Up">
   <action name="Maximize"/>
</keybind>

This Ubuntu forum thread provides more information. Applications such as opensnapAUR are also available to automatically simulate window snapping behaviour without the use of keybinds. Another option is to use bunsen-utilities-gitAUR which provides bl-aerosnap --left and bl-aerosnap --right commands which will snap active window on left or right edge respectively if it's not snapped and restore it to original size and position otherwise. Just bind these commands to the key combination of your choosing.

Smooth display manager transition

Note: This has been confirmed to work with LightDM.

Users of display managers might experience a flickering during the transition between the display manager and the Openbox desktop. The flickering comes from Openbox setting the root window's color during startup. Therefore there's a brief moment when the display flashes in a grey color, between the display manager's background and the desktop's wallpaper.

Setting the root window's background color can be disabled by editing the Openbox startup script found in /usr/lib/openbox/openbox-autostart. Simply comment out (or delete) the block starting with # Set a background color.

Note: Users who don't specifically set their wallpaper will "inherit" the display manager's background automatically if they disable the root window color adjustment.

Window Decorations

To remove window decorations for all or particular applications, use the <decor> option in the <applications> section of rc.xml (user: ~/.config/openbox/ or system: /etc/xdg/openbox/).
Example for Firefox, including variants like Firefox-Beta and Firefox-Nightly:

 <application class="Firefox*">
   <decor>no</decor>
 </application>

One could also disable decorations for all applications (using class "*"), then enable them (using yes) for individual ones. To apply the changes, restart your desktop session, and thus Openbox. Reference: Openbox FAQ

Troubleshooting

Firefox

Mozilla based browsers may ignore application rules (e.g. <desktop>) unless class="Firefox" is used. See #Xprop values for applications.

Missing themes

If for any reason the newly extracted theme cannot be selected, open the theme directory to first ensure that it is compatible with Openbox - there should be an openbox-3 directory and a themerc file within it. An .obt (OpenBox Theme) file may also be present in some instances, which can then be manually loaded in obconf.

A theme may also be not accessible due to wrong permissions. See File permissions and attributes for more.

Stop continuous desktop switching

By default Openbox switches from the last desktop back to the first desktop on mouse wheel scroll. Use <wrap>no</wrap> in the mousebind section to disable this behaviour.

   <context name="Desktop">
     <mousebind button="Up" action="Click">
       <action name="GoToDesktop">
         <to>previous</to>
         <wrap>no</wrap>
       </action>
     </mousebind>
     <mousebind button="Down" action="Click">
       <action name="GoToDesktop">
         <to>next</to>
         <wrap>no</wrap>
       </action>
     </mousebind>
   </context>

Windows load behind the active window

Some application windows (such as Firefox windows) may load behind the currently active window, causing you to need to switch to the window you just created to focus it. To fix this behavior add this to your ~/.config/openbox/rc.xml file, inbetween the <openbox_config> and </openbox_config> tags:

<applications>
  <application class="*">
    <focus>yes</focus>
  </application>
</applications>

See also