![]() |
Openbox >
This is the primary configuration for Openbox
These notes were taken for the Openbox 3.5.x-era.
My current stuff can be found at https://github.com/spiralofhope/misc-configuration/tree/master/live/openbox/rc.xml
Locations:
/etc/xdg/openbox/rc.xml ~/.config/openbox/rc.xml
2016-03-26, Lubuntu 14.04.4 LTS, uses ~/.config/openbox/lubuntu-rc.xml
by default. I just symlink it to its correct name.
Comments in XML / rc.xml ∞
It's the same as with HTML:
<!-- Like so -->
.. or
<!-- Multiple lines can be done like this. I like indenting so things are tidier. -->
Note that openbox will break if you have two dashes (--)
because XML is drunk.
Complex comments in XML / rc.xml, to allow two dashes ∞
<?ignore I'm able to include two dashes (--) in a block of code if I use XML-style tags. You could choose to use any word instead of "ignore", as long as it's not going to be used by openbox. ?>
This method also allows syntax highlighting to pass through into this disabled block of code, which can be useful.
This is especially useful when commenting-out keyboard shortcut commands, since many of those will use the standard --foo
parameter format.
Content layout ∞
I follow a strict layout for my rc.xml. It's designed to make everything as clear as possible.
- Two space indentation of sections
- Lump cluttering/unimportant XML code
- Whitespace to move unimportant XML code to the side.
-
Fuck you XML, nobody likes you.
∞
This is an example of both lumping up garbage XML and pushing it to the side. It's done in such a way that the most important stuff is clearly visible on the left.
- The key binding
-
The application
Spoiler
Note that this needs to be copy-pasted into a text file and have word wrapping turned off to see the proper effect.
<keybind key="W-w"> <action name="Execute"><startupnotify><enabled>yes</enabled></startupnotify><command> /path/to/application </command></action></keybind> <keybind key="W-S-w"> <action name="Execute"><startupnotify><enabled>yes</enabled></startupnotify><command> /path/to/application </command></action></keybind>
The benefit of a layout like this becomes much clearer with a block of keybindings like those for the desktop:
Spoiler
Note that this needs to be copy-pasted into a text file and have word wrapping turned off to see the proper effect.
<!-- Keybindings for desktops. --> <keybind key="W-d"> <action name="ToggleShowDesktop"/> </keybind> <keybind key="S-W-1"> <action name="SendToDesktop"> <desktop>1</desktop><follow>no</follow></action></keybind> <keybind key="S-W-2"> <action name="SendToDesktop"> <desktop>2</desktop><follow>no</follow></action></keybind> <keybind key="S-W-3"> <action name="SendToDesktop"> <desktop>3</desktop><follow>no</follow></action></keybind> <keybind key="S-W-4"> <action name="SendToDesktop"> <desktop>4</desktop><follow>no</follow></action></keybind> <keybind key="W-1"> <action name="Desktop"> <desktop>1</desktop></action></keybind> <keybind key="W-2"> <action name="Desktop"> <desktop>2</desktop></action></keybind> <keybind key="W-3"> <action name="Desktop"> <desktop>3</desktop></action></keybind> <keybind key="W-4"> <action name="Desktop"> <desktop>4</desktop></action></keybind> <keybind key="W-Left"> <action name="DesktopLeft"> <dialog>no</dialog><wrap>no</wrap></action></keybind> <keybind key="W-Right"> <action name="DesktopRight"> <dialog>no</dialog><wrap>no</wrap></action></keybind> <keybind key="W-Up"> <action name="DesktopUp"> <dialog>no</dialog><wrap>no</wrap></action></keybind> <keybind key="W-Down"> <action name="DesktopDown"> <dialog>no</dialog><wrap>no</wrap></action></keybind> <keybind key="S-W-Left"> <action name="SendToDesktopLeft"> <dialog>no</dialog><wrap>no</wrap></action></keybind> <keybind key="S-W-Right"> <action name="SendToDesktopRight"> <dialog>no</dialog><wrap>no</wrap></action></keybind> <keybind key="S-W-Up"> <action name="SendToDesktopUp"> <dialog>no</dialog><wrap>no</wrap></action></keybind> <keybind key="S-W-Down"> <action name="SendToDesktopDown"> <dialog>no</dialog><wrap>no</wrap></action></keybind> <!-- Keybindings for windows. --> <keybind key="A-F4"> <action name="Close"/> </keybind> <keybind key="A-Escape"> <action name="Lower"/> <action name="FocusToBottom"/><action name="Unfocus"/></keybind> <!-- BUG? - "space" needs to be lowercase. --> <keybind key="A-space"> <action name="ShowMenu"> <menu>client-menu</menu></action></keybind> <keybind key="A-Tab"> <action name="NextWindow"/> </keybind> <keybind key="A-S-Tab"> <action name="PreviousWindow"/> </keybind>
easy rc.xml editing ∞
Once I figured this out, it made my life infinitely easier. I could then fuck around with configuration quickly and easy. I'm all about quick and easy fucking.. urr, wait. I mean configuration.. yeah that's it.
- Multiple commands in rc.xml
- Clearly layed-out scripting. One line per command.
-
waitpid
use, ensuring that the commands are patient.
Spoiler
sh -c "\ geany \\ ~/.themes/minimal-spiralofhope/openbox-3/themerc \\ ~/.config/openbox/rc.xml ;\ waitpid $! ;\ openbox --reconfigure ;\ waitpid $! ;\ xrefresh \\ "
Using &
in a command ∞
XML is a strange beast. Creating a decent shell script not only requires escaping backslashes, but converting & into &
Spoiler
lxterminal --command=" \\ sh -c \"\\ echo 'pm-suspend' \\ sudo pm-suspend && slock \\ \" \\ "
(for slock)
Last updated 2017-10-24 at 06:13:43