document the per app settings in rc.xml.in. some xsd fixes. add the "default" option to all the per-app settings which is the same as not putting it in there at all.

This commit is contained in:
Dana Jansens 2007-05-06 22:04:55 +00:00
parent c51373c201
commit 6cd5f7ea38
4 changed files with 129 additions and 81 deletions

View file

@ -47,32 +47,47 @@
<font place="ActiveWindow">
<name>sans</name>
<size>7</size>
<!-- font size in points -->
<weight>bold</weight>
<!-- 'bold' or 'normal' -->
<slant>normal</slant>
<!-- 'italic' or 'normal' -->
</font>
<font place="InactiveWindow">
<name>sans</name>
<size>7</size>
<!-- font size in points -->
<weight>bold</weight>
<!-- 'bold' or 'normal' -->
<slant>normal</slant>
<!-- 'italic' or 'normal' -->
</font>
<font place="MenuHeader">
<name>sans</name>
<size>8</size>
<!-- font size in points -->
<weight>bold</weight>
<!-- 'bold' or 'normal' -->
<slant>normal</slant>
<!-- 'italic' or 'normal' -->
</font>
<font place="MenuItem">
<name>sans</name>
<size>9</size>
<!-- font size in points -->
<weight>bold</weight>
<!-- 'bold' or 'normal' -->
<slant>normal</slant>
<!-- 'italic' or 'normal' -->
</font>
<font place="OnScreenDisplay">
<name>sans</name>
<size>9</size>
<!-- font size in points -->
<weight>bold</weight>
<!-- 'bold' or 'normal' -->
<slant>normal</slant>
<!-- 'italic' or 'normal' -->
</font>
</theme>
@ -408,38 +423,68 @@
<!-- default menu file (or custom one in $HOME/.config/openbox/) -->
<file>menu.xml</file>
<warpPointer>yes</warpPointer>
<xorStyle>yes</xorStyle>
<hideDelay>250</hideDelay>
<middle>no</middle>
<submenuShowDelay>0</submenuShowDelay>
<desktopMenuIcons>yes</desktopMenuIcons>
<!-- -->
<applicationIcons>yes</applicationIcons>
</menu>
<!-- this section is commented out.. remove this and the ending comment if you
want to use it -->
<applications>
<!--
<application name="this application does not exist">
<decor>yes</decor>
<shade>no</shade>
<position>
<x>center</x>
<y>200</y>
</position>
<focus>yes</focus>
<desktop>1</desktop>
<head>0</head>
# specifies xinerama head
<layer>normal</layer>
# 'above', 'normal', or 'below'
<iconic>no</iconic>
<skip_pager>no</skip_pager>
<skip_taskbar>no</skip_taskbar>
<fullscreen>yes</fullscreen>
<maximized>true</maximized>
# 'Horizontal', 'Vertical' or boolean (yes/no/on/off/true/false)
</application>
<!-- the name or the class can be set, or both. this is used to match
windows when they appear
role can optionally be set, and only as much as you provide will be
checked to see if it matches, eg. if you set role="abc" and the window's
role is actually "abcde" it would match.
-->
<application name="first element of window's WM_CLASS property (see xprop)"
class="second element of window's WM_CLASS property (see xprop)"
role="the window's WM_WINDOW_ROLE property (see xprop)">
<!-- each element can be left out or set to 'default' to specify to not
change that attribute of the window -->
<decor>yes</decor>
<shade>no</shade>
<position>
<!-- the position is only used if both an x and y coordinate are provided
(and not set to 'default') -->
<x>center</x>
<!-- a number or 'center' to center on screen -->
<y>200</y>
<!-- a number or 'center' to center on screen -->
<head>0</head>
<!-- specifies the xinerama head, 'mouse' for wherever the mouse is -->
</position>
<focus>yes</focus>
<!-- if the window should try be given focus when it appears -->
<desktop>1</desktop>
<!-- 0 is the first desktop, 'all' for all desktops -->
<layer>normal</layer>
<!-- 'above', 'normal', or 'below' -->
<iconic>no</iconic>
<skip_pager>no</skip_pager>
<!-- asks to not be shown in pagers -->
<skip_taskbar>no</skip_taskbar>
<!-- asks to not be shown in taskbars. window cycling actions will also
skip past such windows -->
<fullscreen>yes</fullscreen>
<maximized>true</maximized>
<!-- 'Horizontal', 'Vertical' or boolean (yes/no/on/off/true/false) -->
</application>
</applications>
-->
</openbox_config>

View file

@ -199,24 +199,22 @@
</xsd:complexType>
<xsd:complexType name="menu">
<xsd:element maxOccurs="unbounded" name="file" type="xsd:string"/>
<xsd:element minOccurs="0" name="warpPointer" type="ob:bool"/>
<xsd:element minOccurs="0" name="xorStyle" type="ob:bool"/>
<xsd:element minOccurs="0" name="hideDelay" type="xsd:integer"/>
<xsd:element minOccurs="0" name="middle" type="ob:bool"/>
<xsd:element minOccurs="0" name="submenuShowDelay" type="xsd:integer"/>
<xsd:element minOccurs="0" name="desktopMenuIcons" type="ob:bool"/>
<xsd:element minOccurs="0" name="applicationIcons" type="ob:bool"/>
</xsd:complexType>
<xsd:complexType name="window_position">
<xsd:element name="x" type="ob:center_or_int"/>
<xsd:element name="y" type="ob:center_or_int"/>
<xsd:element minOccurs="0" name="head" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="application">
<xsd:element minOccurs="0" name="decor" type="xsd:string"/>
<xsd:element minOccurs="0" name="decor" type="xsd:bool"/>
<xsd:element minOccurs="0" name="shade" type="ob:bool"/>
<xsd:element minOccurs="0" name="position" type="ob:window_position"/>
<xsd:element minOccurs="0" name="focus" type="xsd:string"/>
<xsd:element minOccurs="0" name="desktop" type="xsd:integer"/>
<xsd:element minOccurs="0" name="head" type="xsd:string"/>
<xsd:element minOccurs="0" name="layer" type="ob:layer"/>
<xsd:element minOccurs="0" name="iconic" type="ob:bool"/>
<xsd:element minOccurs="0" name="skip_pager" type="ob:bool"/>
@ -434,9 +432,9 @@
</xsd:simpleType>
<xsd:simpleType name="layer">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="above"/>
<xsd:enumeration value="normal"/>
<xsd:enumeration value="below"/>
<xsd:enumeration value="Above"/>
<xsd:enumeration value="Normal"/>
<xsd:enumeration value="Below"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="maximization">

View file

@ -639,13 +639,13 @@ static ObAppSettings *client_get_settings_state(ObClient *self)
|| (app->class && app->name && !strcmp(app->class, self->class)
&& !strcmp(app->name, self->name)))
{
ob_debug("Window matching: %s\n", app->name);
/* Match if no role was specified in the per app setting, or if the
* string matches the beginning of the role, since apps like to set
* the role to things like browser-window-23c4b2f */
if (!app->role
|| !strncmp(app->role, self->role, strlen(app->role)))
{
ob_debug("Window matching: %s\n", app->name);
/* use this one */
settings = app;
break;

View file

@ -102,8 +102,8 @@ GSList *config_per_app_settings;
<position>
<x>700</x>
<y>0</y>
</position>
<head>1</head>
</position>
</application>
</applications>
*/
@ -151,16 +151,19 @@ static void parse_per_app_settings(ObParseInst *i, xmlDocPtr doc,
settings->decor = -1;
if ((n = parse_find_node("decor", app->children)))
if (!parse_contains("default", doc, n))
settings->decor = parse_bool(doc, n);
settings->shade = -1;
if ((n = parse_find_node("shade", app->children)))
if (!parse_contains("default", doc, n))
settings->shade = parse_bool(doc, n);
settings->position.x = settings->position.y = 0;
settings->pos_given = FALSE;
if ((n = parse_find_node("position", app->children))) {
if ((c = parse_find_node("x", n->children))) {
if ((c = parse_find_node("x", n->children)))
if (!parse_contains("default", doc, c)) {
gchar *s = parse_string(doc, c);
if (!strcmp(s, "center")) {
settings->center_x = TRUE;
@ -172,7 +175,8 @@ static void parse_per_app_settings(ObParseInst *i, xmlDocPtr doc,
g_free(s);
}
if (x_pos_given && (c = parse_find_node("y", n->children))) {
if (x_pos_given && (c = parse_find_node("y", n->children)))
if (!parse_contains("default", doc, )) {
gchar *s = parse_string(doc, c);
if (!strcmp(s, "center")) {
settings->center_y = TRUE;
@ -183,25 +187,10 @@ static void parse_per_app_settings(ObParseInst *i, xmlDocPtr doc,
}
g_free(s);
}
}
settings->focus = -1;
if ((n = parse_find_node("focus", app->children)))
settings->focus = parse_bool(doc, n);
if ((n = parse_find_node("desktop", app->children))) {
gchar *s = parse_string(doc, n);
if (!strcmp(s, "all"))
settings->desktop = DESKTOP_ALL;
else
settings->desktop = parse_int(doc, n);
g_free(s);
} else
settings->desktop = DESKTOP_ALL - 1; /* lets hope the user
* doesn't have 2^32
* desktops */
if ((n = parse_find_node("head", app->children))) {
if (settings->pos_given &&
(c = parse_find_node("head", n->children)))
if (!parse_contains("default", doc, n)) {
gchar *s = parse_string(doc, n);
if (!strcmp(s, "mouse"))
settings->head = -1;
@ -209,6 +198,24 @@ static void parse_per_app_settings(ObParseInst *i, xmlDocPtr doc,
settings->head = parse_int(doc, n);
g_free(s);
}
}
settings->focus = -1;
if ((n = parse_find_node("focus", app->children)))
if (!parse_contains("default", doc, n))
settings->focus = parse_bool(doc, n);
if ((n = parse_find_node("desktop", app->children)))
if (!parse_contains("default", doc, n)) {
gchar *s = parse_string(doc, n);
if (!strcmp(s, "all"))
settings->desktop = DESKTOP_ALL;
else
settings->desktop = parse_int(doc, n);
g_free(s);
} else
/* lets hope the user doesn't have 2^32 desktops */
settings->desktop = DESKTOP_ALL - 1;
settings->layer = -2;
if ((n = parse_find_node("layer", app->children))) {
@ -663,15 +670,13 @@ static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
parse_expand_tilde(c));
g_free(c);
}
if ((n = parse_find_node("warpPointer", node)))
config_menu_warppointer = parse_bool(doc, n);
if ((n = parse_find_node("hideDelay", node)))
config_menu_hide_delay = parse_int(doc, n);
if ((n = parse_find_node("middle", node)))
config_menu_middle = parse_bool(doc, n);
if ((n = parse_find_node("submenuShowDelay", node)))
config_submenu_show_delay = parse_int(doc, n);
if ((n = parse_find_node("desktopMenuIcons", node)))
if ((n = parse_find_node("applicationIcons", node)))
config_menu_client_list_icons = parse_bool(doc, n);
}
}