Openbox
Openbox is a lightweight, stacking window manager for the X Window System, designed to be highly configurable and compliant with standards such as those from freedesktop.org, allowing users to extensively customize desktop interactions and window management while maintaining minimal resource usage.[1][2] It originated as a fork of Blackbox in 2002, developed initially by Dana Jansens with a focus on standards compliance before aesthetics, diverging from the typical window manager development approach.[3][4][5] Licensed under the GNU General Public License version 2 or later, Openbox emphasizes the box visual style, enabling theme developers to create sleek, minimalistic interfaces.[3]
The project has evolved through contributions, including from Mikael Magnusson starting in 2004, with the latest stable release being version 3.6.1, released in 2015, featuring enhancements like improved theme rendering, SVG icon support, and advanced action scripting. A release candidate for version 3.7 is available in some distributions as of 2025.[3][6][7][8] Openbox is particularly noted for its integration capabilities, serving as the default window manager in lightweight desktop environments such as LXDE and LXQt, and it can replace the default window managers in heavier environments like GNOME and KDE for better performance on resource-constrained systems.[4][9][10] Its configuration is handled via XML files and tools like ObConf, supporting features such as dynamic menus, keyboard shortcuts, and mouse gestures, making it suitable for both novice users seeking simplicity and advanced users desiring full control.[2]
Overview
Introduction
Openbox is a free and open-source stacking window manager designed for the X Window System, providing users with a flexible foundation for desktop environments on Unix-like operating systems.[2] It is licensed under the GNU General Public License version 2 or later, allowing for free redistribution and modification while ensuring compatibility with open-source principles.[11] As a stacking window manager, Openbox arranges windows in overlapping layers, enabling efficient management of graphical applications without the overhead of a full desktop environment.[4]
The primary purpose of Openbox is to deliver a lightweight and performant solution for window management, emphasizing speed and resource efficiency to support minimalistic setups.[1] It excels in handling window placement, decorations such as borders and titles, and user interactions like resizing and moving, all while maintaining a clean and unobtrusive interface.[2] Highly configurable, Openbox permits extensive customization of its behavior and appearance, making it ideal for users seeking a tailored, low-footprint desktop experience.[1]
Openbox originated as a fork of the Blackbox window manager, inheriting its visual style while evolving into a more standards-compliant tool.[11]
History and Development
Openbox was initially released on September 18, 2002, by Dana Jansens, a student at Carleton University in Ottawa, Canada.[12][5] The project originated as a fork of Blackbox version 0.65.0, a lightweight window manager written in C++, with early Openbox versions (1.x and 2.x) designed to maintain binary compatibility with Blackbox configurations and themes.[13][11]
A major rewrite began with Openbox 3.0, released in November 2003, which involved reimplementing the codebase entirely in the C programming language to enhance performance, reduce dependencies, and improve extensibility while diverging from Blackbox's architecture.[14] This shift allowed for better integration with modern X11 standards and more efficient resource usage, marking Openbox's transition to a standalone project. Development continued with contributions from Mikael Magnusson starting in 2004. By around 2010, following releases like 3.4.11 in February 2010, major feature development had largely tapered, though later releases such as 3.5.0 (2012) and 3.6.0 (2014) added capabilities like an alt-tab dialog and new action scripting options.[15][6]
The most recent stable release, version 3.6.1, arrived on July 1, 2015, incorporating bug fixes, visual enhancements such as improved theme rendering, and minor optimizations to libobrender for better ABI stability.[16] Since then, the project saw no further stable releases, with the last significant commits occurring in mid-2015 on the GitHub repository (https://github.com/danakj/openbox). However, as of October 2025, a release candidate for version 3.7 (rc2) was published in Debian's experimental repository, indicating some ongoing development effort on a branch.[17] This approach has ensured Openbox remains reliable for lightweight desktop environments like LXQt.
Features
Core Functionality
Openbox operates as a stacking window manager, where client windows can overlap and are organized in a layered hierarchy determined by focus and user interactions, allowing for efficient management of multiple overlapping applications on the screen.[1][18] This model prioritizes the active window by raising it to the top of the stack upon focus, while inactive windows remain layered beneath, supporting seamless navigation without tiling constraints.[19]
Window decorations in Openbox include customizable title bars displaying window titles, borders for resizing and visual separation, and functional buttons typically positioned on the title bar for actions such as minimizing, maximizing, and closing windows.[20] These elements are defined through theme configurations, with the title layout specifying button order (e.g., including iconify, maximize, and close buttons), and borders adjustable for thickness and style to enhance usability.[19]
A key feature is the root window right-click menu, which appears when clicking the desktop background and provides quick access to launching applications, desktop reconfiguration, and other system actions.[21] This menu serves as a central hub for initiating programs and performing common tasks directly from the desktop without additional panels.[18]
Openbox supports multiple virtual desktops or workspaces, enabling users to organize windows across separate screens within the same session, with a default of four desktops configurable to more.[19] Switching between these workspaces can be achieved via keyboard shortcuts or mouse actions, facilitating efficient multitasking by isolating related applications on distinct virtual spaces.[19]
For window management, Openbox includes iconification, which minimizes windows to an icon, dock, or system tray for quick access without cluttering the desktop, often accompanied by optional animations.[20] Additionally, window shading allows users to roll up windows to display only the title bar, temporarily hiding the content while keeping the window active and resizable.[19] These functions are bound to customizable keyboard and mouse actions for intuitive control.[22]
Standards Compliance
Openbox maintains full compliance with the Inter-Client Communication Conventions Manual (ICCCM), the foundational X11 standard for inter-client communication, which governs basic window operations such as mapping, resizing, moving, iconifying, and focus management. This strict adherence ensures predictable behavior for applications relying on core X11 protocols, preventing compatibility issues in heterogeneous environments.[11]
In addition to ICCCM, Openbox provides extensive support for the Extended Window Manager Hints (EWMH), a freedesktop.org specification that builds upon ICCCM to enable advanced desktop features. EWMH compliance allows Openbox to handle virtual desktops, window states (e.g., maximized, shaded), and client hints for taskbars and pagers, facilitating integration with external tools for desktop navigation and window grouping.[11]
Openbox also implements key aspects of XDG specifications under the freedesktop.org umbrella, particularly for menu and session management. It supports parsing of .desktop files through pipe menus, enabling dynamic generation of application menus that conform to the XDG Desktop Menu Specification for portable, standards-based menu structures. For session management, Openbox adheres to XDG Base Directory and autostart protocols, allowing seamless incorporation into desktop sessions without proprietary extensions.[23]
These standards implementations have significant implications for compatibility, permitting Openbox to integrate directly with lightweight panels like tint2—which relies on EWMH for taskbar functionality—and desktop handlers like xfdesktop, which uses XDG for icon and wallpaper management, all without necessitating custom patches or workarounds.[24]
Installation and Setup
Installation Methods
Openbox is a lightweight window manager that can be installed on most Linux distributions through standard package managers, making it accessible for users seeking a minimal desktop environment. On Debian-based systems like Ubuntu, installation involves enabling the universe repository if not already active, followed by running the command [sudo](/page/Sudo) apt install openbox obconf to include the core package and a graphical configuration tool.[25] Similarly, on Arch Linux, users can install it directly with [sudo](/page/Sudo) pacman -S openbox, which pulls in necessary dependencies for basic functionality.[2] For Gentoo users, the process uses the Portage system: emerge --ask x11-wm/openbox, ensuring compilation with system-specific optimizations.[26]
Several Linux distributions include Openbox either pre-installed or as an optional component, facilitating easy adoption without manual compilation. BunsenLabs Linux features Openbox as its default window manager, providing a ready-to-use lightweight setup based on Debian Stable. Lubuntu uses Openbox as its default window manager, both in its original LXDE-based releases and in versions from 18.10 onward which use LXQt; it is pre-installed in Lubuntu. In Fedora, Openbox is optional and can be added via sudo dnf install openbox. For openSUSE, installation uses sudo zypper install openbox, integrating seamlessly with the system's repositories.
For users requiring the latest features or custom builds, Openbox can be compiled from source using its official Git repository. Begin by cloning the repository with git clone https://github.com/Mikachu/openbox.git, then navigate into the directory and run ./bootstrap to prepare the build environment, followed by ./configure --prefix=/usr --sysconfdir=/etc (adjust paths as needed for 64-bit systems with --libdir=/usr/lib64). Compile with make and install as root using sudo make install. Key dependencies include development packages for libxml2, libX11, pango, glib2, imlib2, startup-notification, and Xcursor, along with pkg-config and a C compiler like GCC; specific package names vary by distribution, such as libxml2-dev and libx11-dev on Debian/Ubuntu.[27] This method ensures compatibility with the latest upstream changes but requires an X11 server, as Openbox is not natively supported on Wayland compositors.[1]
Due to its design as a standards-compliant stacking window manager, Openbox has minimal hardware requirements, typically running efficiently on systems with basic X11 support and modest resources, such as 512 MB RAM or less for core operations.[2] Post-installation, users may need to configure an X session to launch Openbox, as detailed in subsequent setup guides.[27]
Initial Setup
After installing Openbox, users can start it as a standalone window manager session through a display manager such as LightDM, GDM, or KDM by selecting the "Openbox" session type from the login menu.[28][29] Alternatively, for command-line initiation without a display manager, add exec openbox-session to the ~/.xinitrc file and run startx, which launches Openbox along with its autostart applications.[28][2] The openbox-session command is preferred over plain openbox as it handles session management, including executing the autostart script before the window manager loads.[2]
To generate default configuration files, create the user directory with mkdir -p ~/.config/openbox and copy the system-wide templates using cp /etc/xdg/openbox/{rc.xml,menu.xml} ~/.config/openbox/, which provides rc.xml for core settings and menu.xml for the root menu.[19][2] Users can then apply these by running openbox --reconfigure to reload without restarting the session, or install and launch obconf (the graphical configuration tool) to generate and edit these files interactively.[19][26]
For a functional desktop environment, install companion applications such as a panel like tint2 for taskbars and system trays, a file manager like pcmanfm for desktop icons and navigation, and a compositor like picom for visual effects such as shadows and transparency.[2][26] These can be added to the session via the autostart mechanism.
Session management in Openbox relies on the autostart script, located at ~/.config/openbox/autostart (or system-wide at /etc/xdg/openbox/autostart), which executes commands at login to launch background applications, set wallpapers, or initialize environment variables.[30][2] For example, add lines like tint2 & or pcmanfm --desktop & to this shell script, ensuring each ends with & to run in the background, then reload with openbox --reconfigure.[30] This file is processed automatically when using openbox-session.[28]
Usage
Basic Window Management
Openbox provides straightforward mechanisms for managing windows in a stacking window manager environment, emphasizing minimalism and user control. Users can open new windows primarily through the root menu, which appears upon right-clicking the desktop background; this menu typically includes entries for launching applications, assuming they have been defined in the configuration or via external menu generators. Closing a window is achieved via the default keybinding Alt+F4, which targets the currently focused window, or by accessing the client menu with Alt+Space and selecting the Close option.[31][26]
For repositioning windows, the standard interaction allows dragging the title bar with the left mouse button to move the entire window freely across the screen. To resize, users position the cursor near any edge or corner of the window—where the cursor changes to indicate the resize direction—and drag with the left mouse button; alternatively, holding Alt while right-dragging any part of the window enables resizing toward the nearest edge, facilitating precise adjustments without relying solely on borders. These mouse-driven operations support efficient everyday manipulation, with keyboard alternatives available for accessibility.[22][2]
Focus management in Openbox defaults to a "sloppy" model, where the active window receives focus either by clicking on it directly or by hovering the mouse over it after a brief 200-millisecond delay to prevent accidental shifts during rapid cursor movement. To cycle through open windows without mouse input, the Alt+Tab key combination switches forward through the stack, while Alt+Shift+Tab moves backward, providing quick navigation among multiple applications.[31][26]
Maximizing a window to fill the screen or restoring it to its previous state is available through the context menu by right-clicking the title bar, which opens options for Maximize and Restore, ensuring users have intuitive paths to adjust window size without delving into keybindings. For full-screen toggling, which hides decorations entirely and differs from standard maximization, users can configure bindings such as Alt+F11.[22][2]
Workspace navigation supports organizing windows across multiple virtual desktops, with default keybindings including Control+Alt+Left/Right/Up/Down Arrow to open the desktop switching dialog. Direct access to individual workspaces can be bound, such as Windows+F1 through F4 for the first four in the default configuration, allowing seamless transitions between sets of windows. These defaults enable productive multitasking by segregating applications across desktops without visual clutter. Customizing these behaviors is covered in the Configuration section.[31][26]
Keyboard and Mouse Interactions
Openbox provides extensive support for keyboard shortcuts and mouse actions to facilitate efficient window management, allowing users to navigate, manipulate, and control windows without relying on graphical menus. These interactions are defined in the configuration file ~/.config/openbox/rc.xml, where keyboard bindings are specified under the <keyboard> section and mouse bindings under the <mouse> section. By default, Openbox includes a set of practical bindings that align with common user expectations in lightweight window managers.[2]
Common default keyboard bindings include Alt+Tab to cycle to the next window, Alt+Shift+Tab to cycle to the previous window, and Alt+F4 to close the focused window. Additional defaults encompass Alt+Space to open the client window menu, Ctrl+Alt+Left (or Right, Up, Down) to open the desktop switching dialog, and Alt+Esc to lower and unfocus the window, effectively sending it to the background. These bindings enable quick transitions between tasks, such as switching desktops or minimizing distractions, and can be customized to suit individual workflows.[2][32]
Mouse interactions in Openbox are context-sensitive, primarily occurring on window elements like the titlebar or the root desktop. Default mouse actions on the titlebar include left-click and drag to move the window, right-click to open the client window menu for options like maximize or close, and middle-click to lower and unfocus the window. Scrolling up or down on the titlebar toggles shading (rolling up the window), while on the root desktop, mouse wheel scrolling switches desktops. Middle-clicking specifically on the window's close button (a titlebar element) executes the close action, providing an intuitive alternative to keyboard shortcuts. These mouse bindings promote fluid manipulation, such as repositioning windows or accessing menus directly from the interface.[2]
The syntax for defining keyboard bindings in rc.xml uses the <keybind> element, where the key attribute specifies the combination with modifiers like A for Alt, W for Super, C for Control, and S for Shift, followed by the key (e.g., <keybind key="A-Tab"><action name="NextWindow"/></keybind> for Alt+Tab). Mouse bindings are nested within <context> elements (e.g., <context name="Titlebar">) and use <mousebind> with button (Left, Right, Middle, Up, Down) and action (Press, Drag, Click) attributes, such as <mousebind button="Right" action="Press"><action name="ShowMenu"><menu>client-menu</menu></action></mousebind> for right-click on titlebar. This XML-based structure ensures precise control over input mappings.[2][4]
Actions can be chained within a single binding to perform sequential operations, enhancing efficiency; for instance, focusing a window might also raise it and warp the mouse pointer to it via multiple <action> tags like <action name="Focus"/> followed by <action name="Raise"/> and <action name="MovePointer"/>. This chaining is particularly useful for behaviors like automatically raising windows on focus or repositioning the cursor to the newly active window. To avoid conflicts between bindings on the root window (global desktop actions) and client windows (per-window controls), Openbox uses distinct contexts—root bindings in <context name="Root"> and client in <context name="Titlebar"> or <context name="Client">—along with unique modifier combinations to prevent overlap, ensuring predictable behavior across different interaction scopes.[2]
Configuration
Core Configuration Files
Openbox primarily relies on two XML-based configuration files to define its behavior, window management rules, and menu structure: rc.xml and menu.xml. These files allow users to customize keybindings, mouse actions, themes, application-specific behaviors, and static menu entries without recompiling the software.[19][21]
The rc.xml file serves as the central configuration hub, organized into hierarchical XML sections that control various aspects of the window manager. The <keyboard> section defines keybindings using <keybind key="C-A-Delete"> elements, where "C" denotes Control and "A" denotes Alt, paired with actions like <action name="Exit"/> to trigger specific behaviors such as closing windows or executing commands. Similarly, the <mouse> section handles mouse interactions through <context name="Titlebar"> blocks, specifying button presses (e.g., <mousebind button="Left" action="Press">) and associated actions for dragging or resizing windows. Theme settings are managed in the <theme> section, which includes attributes like <name>Clearlooks</name> for selecting a theme, <title> for layout strings such as "NLIMC" (representing elements like icon, window label, and close button), and options like <font>DejaVu Sans 8</font> for typography, alongside toggles such as <keepBorder>yes</keepBorder> to preserve window borders on focus changes. Application-specific rules are configured in the <applications> section, where <application class="XTerm" name="xterm"> entries allow per-application overrides, such as forcing decorations (<decor>yes</decor>) or positioning (<position force="yes"> with x/y coordinates), enabling tailored behaviors for different programs.[19]
The menu.xml file governs the static right-click menu system, structured within an <openbox_menu> root element that adheres to the Openbox XML schema for validation. The primary menu is defined under <menu id="root-menu" label="Applications">, serving as the entry point accessed via the default Alt+F1 keybind or mouse action. Individual entries are added using <item label="Terminal"> tags, which can include an icon attribute (e.g., icon="/usr/share/pixmaps/gnome-terminal.png") for visual representation and an embedded <action name="Execute"><execute>gnome-terminal</execute></action> to launch the specified application. Submenus are created with nested <menu id="Utilities" label="Tools"> elements, allowing hierarchical organization of items, while <separator/> tags insert visual dividers and <separator label="System Tools"/> provides labeled headers for grouping. The menu's path is referenced in rc.xml via the <menu> section to integrate it seamlessly.[21]
User-specific configurations override system defaults and are stored in ~/.config/openbox/, where rc.xml and menu.xml reside for personalized setups. System-wide defaults are located in /etc/xdg/openbox/, providing a fallback for new installations or shared environments. These locations follow the XDG Base Directory Specification, ensuring portability across Linux distributions.[19][21]
Changes to these files can be applied dynamically without restarting Openbox by executing the openbox --reconfigure command in a terminal, which parses the XML, validates syntax, and reloads the configuration in real-time. This feature supports iterative tweaking during sessions, though malformed XML may cause errors logged to ~/.xsession-errors.[19]
obconf-qt serves as the primary graphical configuration tool for Openbox as of 2025, providing a user-friendly interface to adjust key aspects of the window manager without manual editing of configuration files.[33][2] It allows users to customize themes, mouse actions, window margins, and basic keyboard bindings through intuitive dialogs and previews. For instance, the themes tab enables installation and selection of visual styles from .obt archive files, while the mouse and keyboard sections facilitate point-and-click assignment of actions like resizing windows or switching desktops.[33] Upon saving changes, obconf-qt automatically generates and updates the rc.xml file in the user's ~/.config/openbox/ directory, ensuring seamless integration with Openbox's core settings.[2]
Another essential graphical tool is obmenu, a modern Python-based editor for visual editing of the Openbox menu structure defined in menu.xml.[34][2] This application offers a tree-based interface where users can add, remove, or reorganize menu items and submenus, such as inserting application launchers or creating hierarchical categories, all without directly handling XML syntax. It supports static menu configurations and can optionally integrate simple dynamic elements, though it focuses on straightforward visual manipulation. Changes made in obmenu are saved directly to menu.xml, allowing for immediate menu customization tailored to user workflows.[34]
Both tools are typically installed via distribution package managers for ease of access; for example, obconf-qt is available as the obconf-qt package on Arch Linux, while obmenu can be obtained from the AUR or source builds requiring Python 3 and GTK dependencies.[2][34] Once installed, the standard workflow involves launching the tool (e.g., via obconf-qt or obmenu), making adjustments through the GUI, saving the configuration, and then executing openbox --reconfigure in a terminal to apply changes without restarting the session. This process ensures real-time updates to Openbox's behavior and appearance.[2]
While effective for beginners and routine tweaks, these graphical tools have limitations, such as an inability to configure complex scripts or advanced dynamic pipe menus, which may require manual file edits for more sophisticated setups. They are best suited for initial or occasional adjustments, with manual tweaks in the core configuration files recommended for advanced customization needs.[2]
Advanced Topics
In Openbox, static menus are defined manually in XML files, primarily menu.xml located in the user's configuration directory ~/.config/openbox/ or the system-wide /etc/xdg/openbox/, allowing for fixed structures of application launchers and actions without runtime generation.[21] These menus provide a lightweight way to organize desktop interactions, contrasting with dynamic alternatives like pipe menus for more static setups.[21]
The root menu, typically the primary entry point, is activated by default through a right-click on the desktop background, though this can be customized via mouse bindings in the rc.xml file under the <mouse> section to alter the trigger, such as binding it to a different button or modifier.[21] Menu positioning is controlled globally in rc.xml via options like <middle>no</middle> to align menus to the top rather than centering them vertically, while delays for submenu appearance and disappearance—such as <submenuShowDelay>100</submenuShowDelay> and <submenuHideDelay>400</submenuHideDelay> in milliseconds—enhance usability by preventing accidental triggers.[19] The overall menu file path is specified in rc.xml under the <menu> section with <file>menu.xml</file>, ensuring the static content loads on startup.[19]
Menu structures in menu.xml begin with an XML declaration and <openbox_menu> root element, adhering to the Openbox schema for validation:
xml
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu xmlns="http://openbox.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://openbox.org/
file:///usr/share/openbox/menu.xsd">
<!-- Menu content here -->
</openbox_menu>
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu xmlns="http://openbox.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://openbox.org/
file:///usr/share/openbox/menu.xsd">
<!-- Menu content here -->
</openbox_menu>
Key elements include <menu id="unique-id" label="Visible Title" icon="path/to/icon.png"> for creating or nesting submenus, where the id allows referencing from other menus or rc.xml, the label sets the displayed text (with optional underscore-prefix for keyboard shortcuts, e.g., _S for "S"ystem), and icon supports image formats like PNG or XPM via paths to files.[21] Individual entries use <item label="Item Name" icon="icon-path"> containing actions, such as <action name="Execute"><execute>command</execute></action> to launch programs.[21] Separators are added with <separator label="Optional Header"/> to visually divide sections, rendering as lines or bold headers.[21] Icons across all elements can be globally disabled in rc.xml by setting <showIcons>no</showIcons> (default: yes), which hides them to simplify the interface.[21]
For application integration, static menus manually incorporate details from .desktop files—standardized by the FreeDesktop.org specification—by copying the Name field for labels and Exec field for commands into <item> elements, ensuring consistency with desktop environments like GNOME or KDE.[21] For instance, a .desktop entry for a terminal might provide "Terminal" as the label and x-terminal-emulator as the exec command, which is then adapted directly into XML without automatic parsing in pure static mode.[21] This approach keeps menus lightweight but requires manual updates when installing new software.
Menus can be hidden or shown globally through rc.xml flags like <hideDelay>250</hideDelay> to auto-hide the root menu after mouse release, applying uniformly across desktops.[19] While per-desktop customization of entire menus is not directly supported, individual items cannot be conditionally shown per desktop via action elements. For broader dynamic extensions, static menus may reference pipe menus briefly, but detailed scripting is handled separately.[21]
A practical example is adding a "System" submenu for power management, nested under the root menu:
xml
<menu id="root-menu" label="Openbox">
<menu id="system" label="System" icon="/usr/share/icons/hicolor/48x48/actions/system-shutdown.png">
<separator label="Power Options"/>
<item label="Shutdown">
<action name="Execute">
<execute>oblogout --shutdown</execute>
</action>
</item>
<item label="Reboot">
<action name="Execute">
<execute>oblogout --reboot</execute>
</action>
</item>
</menu>
</menu>
<menu id="root-menu" label="Openbox">
<menu id="system" label="System" icon="/usr/share/icons/hicolor/48x48/actions/system-shutdown.png">
<separator label="Power Options"/>
<item label="Shutdown">
<action name="Execute">
<execute>oblogout --shutdown</execute>
</action>
</item>
<item label="Reboot">
<action name="Execute">
<execute>oblogout --reboot</execute>
</action>
</item>
</menu>
</menu>
This structure uses oblogout (a common Openbox logout manager) for actions, with icons drawn from system theme directories for visual coherence.[21] After editing menu.xml, restarting Openbox with openbox --reconfigure applies changes without logout.[19]
Pipe menus in Openbox enable the dynamic generation of menu content by executing external scripts and incorporating their XML output directly into the menu structure. This mechanism, often referred to as "pipemenus," allows menus to reflect real-time system states or external data sources, such as lists of running applications or environmental information, without requiring manual reconfiguration of static menu files. By piping the script's standard output (stdout) to Openbox, these menus support extensible and interactive features that enhance usability in lightweight desktop environments.[21]
The syntax for implementing a pipe menu is defined within the menu.xml configuration file using a <menu> element equipped with an execute attribute that specifies the command or script to run. For example, <menu id="dynamic" label="Dynamic Menu" execute="/path/to/script.sh" /> invokes the script upon menu invocation, expecting it to produce XML output wrapped in <openbox_pipe_menu> root tags. This output must conform to Openbox's menu XML schema, typically including elements like <item label="Item Name"> for selectable entries, which can contain <action name="Execute"><execute>target-command</execute></action> to trigger actions such as launching programs. Special characters in labels or commands require XML escaping (e.g., & as &) to ensure valid parsing, and nested <menu> or <separator> elements can create hierarchical or spaced structures. Scripts are commonly written in shell (sh), Python, or Perl, outputting this XML format to stdout while handling errors gracefully to prevent menu failures.[21]
Common applications of pipe menus include generating lists of recent files by scanning user directories or bookmark formats like XBEL, often using basic commands such as ls for file enumeration. For monitoring open windows, scripts may query process information via /proc or tools like ps to produce actionable items for tasks such as killing or renicing processes. System monitoring menus frequently fetch data on CPU frequency, memory usage, or network status using language-specific libraries in Python or Perl. A prominent example is the dynamic application menu, which parses .desktop files from directories like /usr/share/applications to build categorized launchers, as implemented in tools like obamenu. Similarly, workspace lists can be dynamically populated from Openbox's internal client state to display and switch between virtual desktops. These scripts are often sourced from community repositories curated on the official Openbox site.[23][21]
To optimize performance and minimize delays when menus are opened, Openbox implements internal caching of pipe menu outputs during the menu's active display period, reducing redundant script executions. Developers of pipe menu scripts are advised to incorporate application-level caching, such as storing computed results in temporary files or variables, particularly for resource-intensive operations like file system scans or process listings, to further prevent lag in interactive use. This approach balances dynamism with responsiveness, making pipe menus suitable for real-time features without compromising the window manager's lightweight nature.[6]