Help:Applications

From Openbox

(Difference between revisions)
Jump to: navigation, search
m (Settings for specific windows (Per-application settings))
(use obxprop and _OB_APP_* props)
Line 19: Line 19:
  
 
== Finding the class, name and role parameters ==
 
== Finding the class, name and role parameters ==
Per-application settings let you match on what we call class, name and role. The first two are set in the WM_CLASS property which you can find by running <code>xprop WM_CLASS</code> and clicking on the window you want to make a rule for. The output will look like
+
Per-application settings let you match on what we call class, name, role, and type. These can all be determined with the <code>obxprop</code> utility.  Run <code>obxprop | grep "^_OB_APP"</code> to see the value of these four properties.The output will look like
<code><pre>WM_CLASS(STRING) = "urxvt", "URxvt"</pre></code>
+
<code><pre>_OB_APP_TYPE(UTF8_STRING) = "normal"
The first of the strings, "urxvt", is the name, and the second, "URxvt", is the class. You have to specify one of these, but you can also specify both.
+
_OB_APP_TITLE(UTF8_STRING) = "New Tab - Google Chrome"
The role is in a separate property and not all apps set it, but it's useful if you want a property set on the main window of an app but not all the dialogs. To find it, you run <code>xprop WM_WINDOW_ROLE</code>. If it tells you there is no such atom, then the application doesn't use roles on its windows. The role parameter is optional.
+
_OB_APP_CLASS(UTF8_STRING) = "Google-chrome"
 +
_OB_APP_NAME(UTF8_STRING) = "google-chrome"
 +
</pre></code>
 +
 
 +
You have to specify at least one of these. Optionally, you may specify more than one, in which case they must all match for the rule to be applied.
  
 
== Matching windows with wildcards ==
 
== Matching windows with wildcards ==

Revision as of 15:39, 12 February 2010

Contents

Settings for specific windows (Per-application settings)

Per-application settings are specified in the <applications> section of rc.xml

Syntax

A per-app setting is specified as follows:

<applications>
  ...
  <application name="NAME" class="CLASS" role="ROLE">
    ...PROPERTIES...
  </application>
  ...
</applications>

A complete list of possible properties to set is in the default rc.xml file, which you can find in /etc/xdg/openbox/rc.xml.

Finding the class, name and role parameters

Per-application settings let you match on what we call class, name, role, and type. These can all be determined with the obxprop utility. Run obxprop | grep "^_OB_APP" to see the value of these four properties.The output will look like

_OB_APP_TYPE(UTF8_STRING) = "normal"
_OB_APP_TITLE(UTF8_STRING) = "New Tab - Google Chrome"
_OB_APP_CLASS(UTF8_STRING) = "Google-chrome"
_OB_APP_NAME(UTF8_STRING) = "google-chrome"

You have to specify at least one of these. Optionally, you may specify more than one, in which case they must all match for the rule to be applied.

Matching windows with wildcards

When specifying the name, class, or role for a rule, you can use simple wildcard matching with the "*" and "?" characters. A "*" matches any number of characters and a "?" matches any single character.

Matching against multiple rules

As well, multiple rules can be applied to the same window. This lets you do more with less writing. For instance you could write one rule to match against all windows and then later rules could further change things for more specific windows. The rules are matched in the order they appear in your configuration file, so later rules will override previous rules if they both specify the same setting for a window.

Example of per-app settings

Here's an example from rc.xml that uses wildcards, and matches multiple rules against windows:

<applications>
  <!-- match all windows, and remove their decorations -->
  <application class="*">
    <decor>no</decor>
  </application>
  <!-- orage does get decorations though.
       calender app, see http://www.xfce.org/projects/orage/ -->
  <application class="Orage">
    <decor>yes</decor>
  </application>
  <!-- my xterm with screen in it must always be on desktop 2,
       maximized and below everything else -->
  <application name="screen">
    <desktop>2</desktop>
    <maximized>yes</maximized>
    <layer>below</layer>
  </application>
  <!-- i want firefox on desktop 3 and maximized -->
  <application name="Firefox*">
    <desktop>3</desktop>
    <maximized>yes</maximized>
  </application>
  <!-- MPlayer will follow me around when i switch desktop.
       that way i can always watch my vids when coding.
       same goes for Realplayer -->
  <application class="MPlayer">
    <desktop>all</desktop>
    <layer>above</layer>
  </application>
  <application class="Realplay.bin">
    <desktop>all</desktop>
    <layer>above</layer>
  </application>
  <!-- i want nwn always maximized, same for openttd -->
  <application name="Neverwinter Nights Client">
    <maximized>yes</maximized>
  </application>
  <application class="openttd">
    <maximized>yes</maximized>
  </application>
  <!-- A is for Amarok, A is the 1st letter in the alphabet, so
       move Amarok to the first desktop -->
  <application class="Amarokapp">
    <desktop>1</desktop>
    <maximized>yes</maximized>
  </application>
  <!-- Easytag is obviously something which belongs on desktop 6, duh -->
  <application name="easytag">
    <desktop>6</desktop>
    <maximized>yes</maximized>
  </application>
</applications>
Personal tools