Saturday, February 04, 2012

Openbox - Simple application-rule example in rc.xml

Update: Or you could use Obapps (and while you're at it try Obthemes) to set these rules up in a GUI. ;)

In openbox, the only wm you'll ever need (imho(tm)), you can set up rules for application windows. You can define where the window will appear, whether it should be decorated, shades or minimized (iconic). These rules are pretty simple to understand, but examples are always helpful so here goes.

First of all you'll need to know some stuff about the window you're making the rule for. Open a terminal and run:
obxprop | grep OB_APP
and click on your window.

This will output something like:
_OB_APP_TYPE(UTF8_STRING) = "normal"
_OB_APP_TITLE(UTF8_STRING) = "Buddy List"
_OB_APP_CLASS(UTF8_STRING) = "Pidgin"
_OB_APP_NAME(UTF8_STRING) = "Pidgin"
_OB_APP_ROLE(UTF8_STRING) = "buddy_list"
and these are the attributes we'll use below to specify our window. Easy peasy.
<application name="Pidgin" role="buddy_list">
 <decor>default</decor>
 <shade>default</shade>
 <position force="no">
  <x>-5</x>
  <y>center</y>
  <monitor>1</monitor>
 </position>
 <focus>yes</focus>
 <desktop>1</desktop>
 <layer>above</layer>
 <iconic>no</iconic>
 <skip_pager>yes</skip_pager>
 <skip_taskbar>yes</skip_taskbar>
 <fullscreen>default</fullscreen>
 <maximized>default</maximized>
</application>
The rules themselves are pretty well documented in the default rc.xml so I won't go in to details. Sufficed to say, the rule above will position the buddy list 5px out from the right border of the screen (hence the -5) and at the center vertically. It will get focus on appearance and it will stay above other windows (if on lower layers). The window will also be hidden from the alt+tab pager and hidden from any taskbar (tint2 ftw!) you are running (if the taskbar is standards compliant at least).

Well... eeeh... tada!