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"> <font place="ActiveWindow">
<name>sans</name> <name>sans</name>
<size>7</size> <size>7</size>
<!-- font size in points -->
<weight>bold</weight> <weight>bold</weight>
<!-- 'bold' or 'normal' -->
<slant>normal</slant> <slant>normal</slant>
<!-- 'italic' or 'normal' -->
</font> </font>
<font place="InactiveWindow"> <font place="InactiveWindow">
<name>sans</name> <name>sans</name>
<size>7</size> <size>7</size>
<!-- font size in points -->
<weight>bold</weight> <weight>bold</weight>
<!-- 'bold' or 'normal' -->
<slant>normal</slant> <slant>normal</slant>
<!-- 'italic' or 'normal' -->
</font> </font>
<font place="MenuHeader"> <font place="MenuHeader">
<name>sans</name> <name>sans</name>
<size>8</size> <size>8</size>
<!-- font size in points -->
<weight>bold</weight> <weight>bold</weight>
<!-- 'bold' or 'normal' -->
<slant>normal</slant> <slant>normal</slant>
<!-- 'italic' or 'normal' -->
</font> </font>
<font place="MenuItem"> <font place="MenuItem">
<name>sans</name> <name>sans</name>
<size>9</size> <size>9</size>
<!-- font size in points -->
<weight>bold</weight> <weight>bold</weight>
<!-- 'bold' or 'normal' -->
<slant>normal</slant> <slant>normal</slant>
<!-- 'italic' or 'normal' -->
</font> </font>
<font place="OnScreenDisplay"> <font place="OnScreenDisplay">
<name>sans</name> <name>sans</name>
<size>9</size> <size>9</size>
<!-- font size in points -->
<weight>bold</weight> <weight>bold</weight>
<!-- 'bold' or 'normal' -->
<slant>normal</slant> <slant>normal</slant>
<!-- 'italic' or 'normal' -->
</font> </font>
</theme> </theme>
@ -408,38 +423,68 @@
<!-- default menu file (or custom one in $HOME/.config/openbox/) --> <!-- default menu file (or custom one in $HOME/.config/openbox/) -->
<file>menu.xml</file> <file>menu.xml</file>
<warpPointer>yes</warpPointer>
<xorStyle>yes</xorStyle>
<hideDelay>250</hideDelay> <hideDelay>250</hideDelay>
<middle>no</middle> <middle>no</middle>
<submenuShowDelay>0</submenuShowDelay> <submenuShowDelay>0</submenuShowDelay>
<desktopMenuIcons>yes</desktopMenuIcons> <applicationIcons>yes</applicationIcons>
<!-- -->
</menu> </menu>
<!-- this section is commented out.. remove this and the ending comment if you
want to use it -->
<applications> <applications>
<!-- <!-- the name or the class can be set, or both. this is used to match
<application name="this application does not exist"> windows when they appear
<decor>yes</decor>
<shade>no</shade> role can optionally be set, and only as much as you provide will be
<position> checked to see if it matches, eg. if you set role="abc" and the window's
<x>center</x> role is actually "abcde" it would match.
<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>
--> -->
<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> </applications>
-->
</openbox_config> </openbox_config>

View file

@ -199,24 +199,22 @@
</xsd:complexType> </xsd:complexType>
<xsd:complexType name="menu"> <xsd:complexType name="menu">
<xsd:element maxOccurs="unbounded" name="file" type="xsd:string"/> <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="hideDelay" type="xsd:integer"/>
<xsd:element minOccurs="0" name="middle" type="ob:bool"/> <xsd:element minOccurs="0" name="middle" type="ob:bool"/>
<xsd:element minOccurs="0" name="submenuShowDelay" type="xsd:integer"/> <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>
<xsd:complexType name="window_position"> <xsd:complexType name="window_position">
<xsd:element name="x" type="ob:center_or_int"/> <xsd:element name="x" type="ob:center_or_int"/>
<xsd:element name="y" 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>
<xsd:complexType name="application"> <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="shade" type="ob:bool"/>
<xsd:element minOccurs="0" name="position" type="ob:window_position"/> <xsd:element minOccurs="0" name="position" type="ob:window_position"/>
<xsd:element minOccurs="0" name="focus" type="xsd:string"/> <xsd:element minOccurs="0" name="focus" type="xsd:string"/>
<xsd:element minOccurs="0" name="desktop" type="xsd:integer"/> <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="layer" type="ob:layer"/>
<xsd:element minOccurs="0" name="iconic" type="ob:bool"/> <xsd:element minOccurs="0" name="iconic" type="ob:bool"/>
<xsd:element minOccurs="0" name="skip_pager" type="ob:bool"/> <xsd:element minOccurs="0" name="skip_pager" type="ob:bool"/>
@ -434,9 +432,9 @@
</xsd:simpleType> </xsd:simpleType>
<xsd:simpleType name="layer"> <xsd:simpleType name="layer">
<xsd:restriction base="xsd:string"> <xsd:restriction base="xsd:string">
<xsd:enumeration value="above"/> <xsd:enumeration value="Above"/>
<xsd:enumeration value="normal"/> <xsd:enumeration value="Normal"/>
<xsd:enumeration value="below"/> <xsd:enumeration value="Below"/>
</xsd:restriction> </xsd:restriction>
</xsd:simpleType> </xsd:simpleType>
<xsd:simpleType name="maximization"> <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) || (app->class && app->name && !strcmp(app->class, self->class)
&& !strcmp(app->name, self->name))) && !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 /* 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 * string matches the beginning of the role, since apps like to set
* the role to things like browser-window-23c4b2f */ * the role to things like browser-window-23c4b2f */
if (!app->role if (!app->role
|| !strncmp(app->role, self->role, strlen(app->role))) || !strncmp(app->role, self->role, strlen(app->role)))
{ {
ob_debug("Window matching: %s\n", app->name);
/* use this one */ /* use this one */
settings = app; settings = app;
break; break;

View file

@ -102,8 +102,8 @@ GSList *config_per_app_settings;
<position> <position>
<x>700</x> <x>700</x>
<y>0</y> <y>0</y>
<head>1</head>
</position> </position>
<head>1</head>
</application> </application>
</applications> </applications>
*/ */
@ -151,64 +151,71 @@ static void parse_per_app_settings(ObParseInst *i, xmlDocPtr doc,
settings->decor = -1; settings->decor = -1;
if ((n = parse_find_node("decor", app->children))) if ((n = parse_find_node("decor", app->children)))
settings->decor = parse_bool(doc, n); if (!parse_contains("default", doc, n))
settings->decor = parse_bool(doc, n);
settings->shade = -1; settings->shade = -1;
if ((n = parse_find_node("shade", app->children))) if ((n = parse_find_node("shade", app->children)))
settings->shade = parse_bool(doc, n); if (!parse_contains("default", doc, n))
settings->shade = parse_bool(doc, n);
settings->position.x = settings->position.y = 0; settings->position.x = settings->position.y = 0;
settings->pos_given = FALSE; settings->pos_given = FALSE;
if ((n = parse_find_node("position", app->children))) { if ((n = parse_find_node("position", app->children))) {
if ((c = parse_find_node("x", n->children))) { if ((c = parse_find_node("x", n->children)))
gchar *s = parse_string(doc, c); if (!parse_contains("default", doc, c)) {
if (!strcmp(s, "center")) { gchar *s = parse_string(doc, c);
settings->center_x = TRUE; if (!strcmp(s, "center")) {
x_pos_given = TRUE; settings->center_x = TRUE;
} else { x_pos_given = TRUE;
settings->position.x = parse_int(doc, c); } else {
x_pos_given = TRUE; settings->position.x = parse_int(doc, c);
x_pos_given = TRUE;
}
g_free(s);
} }
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)))
gchar *s = parse_string(doc, c); if (!parse_contains("default", doc, )) {
if (!strcmp(s, "center")) { gchar *s = parse_string(doc, c);
settings->center_y = TRUE; if (!strcmp(s, "center")) {
settings->pos_given = TRUE; settings->center_y = TRUE;
} else { settings->pos_given = TRUE;
settings->position.y = parse_int(doc, c); } else {
settings->pos_given = TRUE; settings->position.y = parse_int(doc, c);
settings->pos_given = TRUE;
}
g_free(s);
}
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;
else
settings->head = parse_int(doc, n);
g_free(s);
} }
g_free(s);
}
} }
settings->focus = -1; settings->focus = -1;
if ((n = parse_find_node("focus", app->children))) if ((n = parse_find_node("focus", app->children)))
settings->focus = parse_bool(doc, n); if (!parse_contains("default", doc, n))
settings->focus = parse_bool(doc, n);
if ((n = parse_find_node("desktop", app->children))) { if ((n = parse_find_node("desktop", app->children)))
gchar *s = parse_string(doc, n); if (!parse_contains("default", doc, n)) {
if (!strcmp(s, "all")) gchar *s = parse_string(doc, n);
settings->desktop = DESKTOP_ALL; if (!strcmp(s, "all"))
else settings->desktop = DESKTOP_ALL;
settings->desktop = parse_int(doc, n); else
g_free(s); settings->desktop = parse_int(doc, n);
} else g_free(s);
settings->desktop = DESKTOP_ALL - 1; /* lets hope the user } else
* doesn't have 2^32 /* lets hope the user doesn't have 2^32 desktops */
* desktops */ settings->desktop = DESKTOP_ALL - 1;
if ((n = parse_find_node("head", app->children))) {
gchar *s = parse_string(doc, n);
if (!strcmp(s, "mouse"))
settings->head = -1;
else
settings->head = parse_int(doc, n);
g_free(s);
}
settings->layer = -2; settings->layer = -2;
if ((n = parse_find_node("layer", app->children))) { 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)); parse_expand_tilde(c));
g_free(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))) if ((n = parse_find_node("hideDelay", node)))
config_menu_hide_delay = parse_int(doc, n); config_menu_hide_delay = parse_int(doc, n);
if ((n = parse_find_node("middle", node))) if ((n = parse_find_node("middle", node)))
config_menu_middle = parse_bool(doc, n); config_menu_middle = parse_bool(doc, n);
if ((n = parse_find_node("submenuShowDelay", node))) if ((n = parse_find_node("submenuShowDelay", node)))
config_submenu_show_delay = parse_int(doc, n); 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); config_menu_client_list_icons = parse_bool(doc, n);
} }
} }