Window managers -2- Openbox (ENG)

This article has been originally published in Italian (here). Feedbacks on content and translation are appreciated. Contributions are welcome. The original article must be considered the reference in case of updates.

After the brief introduction in my previous post, I am going now to have a look at each one of the window managers listed there. I will start with one of the members of the “*box” family: Openbox.

Openbox (home page) was built upon Blackbox, which I did not mention in the introduction because its development has stopped back in 2005 (rel. 0.70.1). Since version 3 code has been rewritten from scratch, leaving definitively behind the Blackbox heritage.

Despite its slow development, Openbox (shortly “OB”) is very appreciated and widely used as a base for many distributions, even recently released. For example Lubuntu, Ubuntu’s flavour featuring LXDE, is based on Openbox with the addition of many useful “tools”, developed by the LXDE team, that provide some features Openbox natively lacks.

OB has earned itself a vast user base and a number of distributions (the linked page is a bit old but gives a meaningful picture) that have chosen it as their main environment. Stability, lightness, ease of configuration, compliance to standards make OB an ideal environment to achieve a functional and versatile desktop for all uses.


Installation

openbox_installFirst off, I am going to install the required packages from the Ubuntu repositories. The addition to base system (minimal install of Ubuntu 12.10 Quantal) takes little disk space, as one might expect, with the two metapackages sharing approximately evenly the total. At the end of installation we can start graphical session right away with startx at command prompt.

sticky_notes_128Note: to automatically start X server (that is: graphics) at login one chance is to add a login manager (that I have avoided, fro the moment), another one is to add the same startx at the bottom of file ~/.profile. A simple and light login manager is Slim (home page).

Except for availability or name of packages in the repositories of different distributions, the hints I’ll be giving are applicable to every distribution using Openbox.

Icon source: http://findicons.com/pack/1035/human_o2


Desktop

openbox_desktop

Openbox desktop – Click to see it full size (1024 x 768)

The very first glance is not so promising: only the mouse pointer on a grey empty desktop background. A right mouse click brings up the system menu, quite meagre actually. Listed applications are only the terminal and the configurations manager Obconf  (there’s an item to start the default browser, but no browser is installed!).

The “Desktop” sub-menu lists open windows on each workspace: as no taskbar/panel is available yet, this menu is the only way to switch between windows using mouse. This or nice and old Alt-Tab. Here workspaces can be added or removed without directly modifying configuration files.

From the terminal (that is pretty much all we have) we can collect some preliminary “system information” (in brackets [ ] the command):

  • Used RAM [free -m]: 37 MB (including terminal ~ 3 MB)
  • Total disk space [df -h]: 1.2 GB
  • Version of “openbox” package [dpkg-query -W -f='${Version}\n' openbox]: 3.5.0-4
  • Used kernel [uname -a]: 3.5.0.21-generic

In RAM Openbox is a feather-weight: in comparison the pure minimal, command line only, takes about 22 MB. That indeed makes sense in such a basic environment and seem to urge us to customize and “pimp” it to make it more usable and eye-pleasing. The screenshots gallery on the project page shows plenty of different customizations.


Configuration

Once for all: as for each “essential” WMs lots of RTFM is due 😉 and a good attitude to explore and discover in order to “fine tune” OB. Nothing that will make you tear your hair out, but you’ll need some dedication. First place to look into is the documentation section of the Openbox wiki: its contents provide a comprehensive picture of functionalities and related items in the configuration files. Wiki pages are quite detailed but seem not to be updated for latest releases. Much of the information refers to release 3.4 and some pages are not very easy to find; however, there’s pretty much everything you need in there and a little patience will pay!

Well, time to fire up a terminal (there’s not much else…) and copy the default configuration files from the OB folder to our home folder (this way you will have per user settings):

~$ cp /etc/xdg/openbox/* ~/.config/openbox

All you need to “shape” the system is just four files:

  • rc.xml (graphics settings, keyboard and mouse shortcuts, etc.)
  • menu.xml (system menu structure and items)
  • autostart (applications started at boot time)
  • environment (environment variables: language, path, etc.)

It is advisable to modify only the configuration files in our folder rather than the default ones (then settings will be applied system-wide) so that we always keep safe a working configuration, because you never know ;-). And a backup every now and then, while we tinker with settings…

[rc.xml]

File rc.xml holds most of the system settings. Basically, the file is split in four blocks, each one editable through a GUI software (in addition, of course, to manual modifications):

  1. graphics and windows management: theme, dock position, number and name of workspaces and much else is easily managed by ObConf (see picture above), which is part of the openbox metapackage;
  2. keyboard and mouse shortcuts (keybindings e mousebindings, sections <keyboard> and <mouse>): Obkeys (home page) can set keyboard shortcuts only. For mouse actions the reference is “Bindings” page in the wiki;
  3. menu behaviour (section <menu>): list here files containing the system menu (menu.xml) and other ones that will appear as sub-menus. Additionally, some settings related to menu appearance and layout can be modified here (delay before showing/hiding menu items, sub-menu position relative to main menu, etc.). ObMenu (see below) helps to easily define structure of all used menu files;
  4. per application settings (section <applications>): ObApps (home page) manages the “profiles” associated to specific applications (example: terminal windows always without decorations or maximized).

tipTip: it is convenient to add a keybind to show the main menu. By default there is only the “right click on desktop” mousebind. That could force us to minimize a full screen window (e.g. a browser) to get to a “free” area on desktop to click on. A dedicated keybind (for example ‘Windows key’ + ‘m’) solves this little annoyance. The code to add (and customize) to section <keyboard> in rc.xml is the following:

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

File rc.xml is thoroughly commented in each part, that makes life a lot easier for the ones who peek into it, and the related wiki page is very complete as well: enjoy the reading :-).

Icon source: http://findicons.com/pack/1035/human_o2

[menu.xml]

While Obconf takes care of “appearance”, Obmenu (pkg: obmenu) takes care of “substance” that is menu items layout (held in menu.xml). The picture below shows the menu structure, to which I have added an item to launch the text editor Leafpad (pkg: leafpad – easy to use and very light).

obmenu

Obmenu – adding a menu item

I find Obmenu particularly useful since it displays the menu/sub-menu branching, that would not be noticeable when manually editing menu files.

Obmenu, however, is not able to associate icons to menu items. This would require a little manual addition to menu entries, as shown below:

<item label="ObConf" icon="/usr/share/pixmaps/obconf.png">
  <action name="Execute">
    <execute>obconf</execute>
  </action>
</item>

icone_menuBasically beside the “label” (entry description) an “icon” definition must be added, complete with the full icon path. Allowed icon formats are .png and .xpm  (I have tested these two, more formats might be supported – .svg for sure are not) of any size: in menu they will anyway be scaled down to 16×16. Menu icons are a new feature, added since release 3.5.0 (changelog).

Here I have added just a couple of them because it was late and I was sleepy…

Source of information the always useful Arch Linux wiki, thanks to an user with the same avatar as mine: kind of an “epic win”! 😎

In the meantime ObMenu let me add some more entries and subsections to the menu.

I am really beginning to like Openbox 😆

[autostart]

At last an easy and plain file: ~/.config/openbox/autostart contains a list of commands to be launched at boot, one in each row. No formats, tags or peculiar syntax. Usually in this file we’ll place commands to start a panel/taskbar (like tint2 – pkg: tint2home page), applications placed in the dock (more details in a while…) and we’ll set a background image by feh (pkg: feh) or similar programs, as you can see in the file excerpt below (dockapps wmwork, wmnet and wmweather from repositories, here more details).

feh --bg-scale ~/wallpaper.jpg
wmwork &
wmnet -w --txcolor=RED --rxcolor=BLUE --label=Rete -d 200000 &
wmweather --station=LIRN -m --proxy=my.proxy.com:8080 -g &
tint2 &

Some “dockable” applications usually have a specific option to trigger this behaviour (like “-w“: windowed); without such an option they appear in standard windows.

[environment]

In file ~/.config/openbox/environment we can declare and set system variables. First of all your system language (LANG=it_IT.UTF8 for Italian, en_US.UTF8 for American English  and so on) and additions to PATH. In general “exporting” a variable follows the syntax: export Variable_Name=Value. Openbox wiki page has not much else to say, too…

Interesting features

openbox_dock_hor

Un dock D.O.C.!

The dock (wiki OB) might compare to a so called “system tray” when a panel is not used. Many different applications can be placed in it (weather, system information, a desktop pager and much more) “filling the gaps” in what OB natively lacks. Dock can be placed on any edge and corner of screen but will be visible only when it holds some application.

Much more interesting and versatile are “pipe menus“, an OB distinctive feature. Those are dynamic menus, generated at each opening by the execution a script (bash, PERL, Python, etc.). Script output, conveniently formatted, makes up the menu entries and content.

Pipemenu

Pipemenu

Chances are practically countless: we might simply display basic system information (RAM, CPU load, etc.) or control other applications (for example managing playlists of the multimedia player). Those who have at least basic coding skills are very welcome to give their contribution, those who don’t will just google for hints: user-supplied pipe menus make a long and varied list. You can find dozens of them here or in the wiki, to start with. Or you can try and create your own, as I have shamefully done:

freemem=$(free -m | grep cache: | cut -c27-29)
upt=$(uptime | awk -F\  '{ print $3 $4 }')
io=$(whoami)
echo "<openbox_pipe_menu>"
echo "<item label=\"User: $io\"/>"
echo "<item label=\"logged in since $upt\"/>"
echo "<item label=\"Used memory $freemem MB\"/>"
echo "</openbox_pipe_menu>"

Required syntax is highlighted (tags for start and end of menu and content rows).


Distributions and Further References

Well, it seems I can close it here: now you are more than ready to dress your penguin with a tailored Openbox suit. OB is available in the repositories of any distribution (otherwise we should have compiled from source!). If you are really lazy, here is a list (I promised) of some distributions ready to use with Openbox:

  • Crunchbang (Debian): nice user base, rich wiki;
  • Archbang (Arch): Arch users seem to be particularly fond of OB, Archbang wiki (not to mention Arch wiki) are a treasure trove;
  • Lubuntu (Ubuntu – LXDE): ready, feature-rich, light, Ubuntu, the latest one of official derivatives has rapidly become the choice of many users;
  • PCLinuxOS (Mandriva – LXDE): I do not know quite well the original distribution (that is anyway part of Linux “history”, after several renamings) but I have seen a quite sound user base, even though they mostly use the “flagship” version with KDE;
  • Semplice Linux (Debian unstable) and SalentOS (Ubuntu): I am especially pleased to mention them because they come from Italian developers! Both distros take advantage of Debian and Ubuntu community, making it easy and quick to find help.

Many more distributions can be found on Distrowatch (yes, this link takes you directly to the search, you lazy guys!).

Finally, if you are not yet tired of reading:

  • Community portal links to many applications developed for Openbox;
  • Openbox how-to on Urukrama blog (slightly out of date, but you’ll find some updated blog posts on topic).

I think (and I hope for you all!) I have nothing else to add on Openbox: for sure I have got a pretty nice impression from it and I have enlisted it as one of possible alternatives to my dearest KDE. I will keep you updated in case I find out something else, always here.

Stay tuned for some more well-researched, hard-worked, endless posts about window managers.

Informazioni su Man from Mars

https://extendedreality.wordpress.com/

  1. Pingback: ASCII art: Openbox logo | Extended Reality

  2. Pingback: Window managers -1- Introduction | Extended Reality

  3. Pingback: Linux speaks Italian: review of Semplice Linux 7.0 ‘Comfortably Numb’ | Extended Reality

Comments are disabled. Please comment and share on Twitter, G+, Facebook.

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

%d blogger hanno fatto clic su Mi Piace per questo: