all repos — openbox @ 6cf3357036561134383198cc8b853abb3fe5a982

openbox fork - make it a bit more like ryudo

allow app rules to match windows by their title when mapping

and save the title in the _OB_APP_TITLE property
Dana Jansens danakj@orodu.net
commit

6cf3357036561134383198cc8b853abb3fe5a982

parent

ae85462f2bf0812755a29ea17080b14f681acaf4

M data/rc.xmldata/rc.xml

@@ -693,18 +693,19 @@ <applications>

<!-- # this is an example with comments through out. use these to make your # own rules, but without the comments of course. - # you may use one or more of the name/class/role/type rules to specify + # you may use one or more of the name/class/role/title/type rules to specify # windows to match <application name="the window's _OB_APP_NAME property (see obxprop)" class="the window's _OB_APP_CLASS property (see obxprop)" role="the window's _OB_APP_ROLE property (see obxprop)" + title="the window's _OB_APP_TITLE property (see obxprop)" type="the window's _OB_APP_TYPE property (see obxprob).. (if unspecified, then it is 'dialog' for child windows)"> - # you may set only one of name/class/role/type, or you may use more than one - # together to restrict your matches. + # you may set only one of name/class/role/title/type, or you may use more + # than one together to restrict your matches. - # the name, class, and role use simple wildcard matching such as those + # the name, class, role, and title use simple wildcard matching such as those # used by a shell. you can use * to match any characters and ? to match # any single character.
M data/rc.xsddata/rc.xsd

@@ -246,9 +246,10 @@ <xsd:element minOccurs="0" name="skip_taskbar" type="ob:bool"/>

<xsd:element minOccurs="0" name="fullscreen" type="ob:bool"/> <xsd:element minOccurs="0" name="maximized" type="ob:maximization"/> </xsd:all> + <!-- at least one of these must be present --> <xsd:attribute name="role" type="xsd:string"/> + <xsd:attribute name="title" type="xsd:string"/> <xsd:attribute name="type" type="ob:clienttype"/> - <!-- at least one of these must be present --> <xsd:attribute name="name" type="xsd:string"/> <xsd:attribute name="class" type="xsd:string"/> </xsd:complexType>
M obt/prop.cobt/prop.c

@@ -192,6 +192,7 @@ CREATE_(OB_WM_STATE_UNDECORATED);

CREATE_(OB_CONTROL); CREATE_(OB_VERSION); CREATE_(OB_APP_ROLE); + CREATE_(OB_APP_TITLE); CREATE_(OB_APP_NAME); CREATE_(OB_APP_CLASS); CREATE_(OB_APP_TYPE);
M obt/prop.hobt/prop.h

@@ -213,6 +213,7 @@ OBT_PROP_OB_CONFIG_FILE,

OBT_PROP_OB_CONTROL, OBT_PROP_OB_VERSION, OBT_PROP_OB_APP_ROLE, + OBT_PROP_OB_APP_TITLE, OBT_PROP_OB_APP_NAME, OBT_PROP_OB_APP_CLASS, OBT_PROP_OB_APP_TYPE,
M openbox/client.copenbox/client.c

@@ -236,7 +236,8 @@ client_get_all(self, TRUE);

ob_debug("Window type: %d", self->type); ob_debug("Window group: 0x%x", self->group?self->group->leader:0); - ob_debug("Window name: %s class: %s role: %s", self->name, self->class, self->role); + ob_debug("Window name: %s class: %s role: %s title: %s", + self->name, self->class, self->role, self->title); /* per-app settings override stuff from client_get_all, and return the settings for other uses too. the returned settings is a shallow copy,

@@ -796,7 +797,8 @@ ObAppSettings *app = it->data;

gboolean match = TRUE; g_assert(app->name != NULL || app->class != NULL || - app->role != NULL || (signed)app->type >= 0); + app->role != NULL || app->title != NULL || + (signed)app->type >= 0); if (app->name && !g_pattern_match(app->name, strlen(self->name), self->name, NULL))

@@ -808,6 +810,10 @@ match = FALSE;

else if (app->role && !g_pattern_match(app->role, strlen(self->role), self->role, NULL)) + match = FALSE; + else if (app->title && + !g_pattern_match(app->title, + strlen(self->title), self->title, NULL)) match = FALSE; else if ((signed)app->type >= 0 && app->type != self->type) { match = FALSE;

@@ -1083,15 +1089,15 @@ /* get the session related properties, these can change decorations

from per-app settings */ client_get_session_ids(self); - /* save the values of the variables used for app rule matching */ - client_save_app_rule_values(self); - /* now we got everything that can affect the decorations */ if (!real) return; /* get this early so we have it for debugging */ client_update_title(self); + + /* save the values of the variables used for app rule matching */ + client_save_app_rule_values(self); client_update_protocols(self);

@@ -2310,6 +2316,7 @@

OBT_PROP_SETS(self->window, OB_APP_ROLE, utf8, self->role); OBT_PROP_SETS(self->window, OB_APP_NAME, utf8, self->name); OBT_PROP_SETS(self->window, OB_APP_CLASS, utf8, self->class); + OBT_PROP_SETS(self->window, OB_APP_TITLE, utf8, self->original_title); switch (self->type) { case OB_CLIENT_TYPE_NORMAL:
M openbox/config.copenbox/config.c

@@ -200,8 +200,9 @@ */

static void parse_per_app_settings(xmlNodePtr node, gpointer d) { xmlNodePtr app = obt_xml_find_node(node->children, "application"); - gchar *name = NULL, *class = NULL, *role = NULL, *type_str = NULL; - gboolean name_set, class_set, type_set, role_set; + gchar *name = NULL, *class = NULL, *role = NULL, *title = NULL, + *type_str = NULL; + gboolean name_set, class_set, type_set, role_set, title_set; ObClientType type; gboolean x_pos_given;

@@ -212,6 +213,7 @@ class_set = obt_xml_attr_string(app, "class", &class);

name_set = obt_xml_attr_string(app, "name", &name); type_set = obt_xml_attr_string(app, "type", &type_str); role_set = obt_xml_attr_string(app, "role", &role); + title_set = obt_xml_attr_string(app, "title", &title); /* validate the type tho */ if (type_set) {

@@ -235,7 +237,7 @@ else

type_set = FALSE; /* not valid! */ } - if (class_set || name_set || role_set || type_set) { + if (class_set || name_set || role_set || title_set || type_set) { xmlNodePtr n, c; ObAppSettings *settings = config_create_app_settings();;

@@ -247,6 +249,9 @@ settings->class = g_pattern_spec_new(class);

if (role_set) settings->role = g_pattern_spec_new(role); + + if (title_set) + settings->title = g_pattern_spec_new(title); if (type_set) settings->type = type;

@@ -352,7 +357,8 @@ (gpointer) settings);

g_free(name); g_free(class); g_free(role); - name = class = role = NULL; + g_free(title); + name = class = role = title = NULL; } app = obt_xml_find_node(app->next, "application");

@@ -1074,6 +1080,7 @@ for (it = config_per_app_settings; it; it = g_slist_next(it)) {

ObAppSettings *itd = (ObAppSettings *)it->data; if (itd->name) g_pattern_spec_free(itd->name); if (itd->role) g_pattern_spec_free(itd->role); + if (itd->title) g_pattern_spec_free(itd->title); if (itd->class) g_pattern_spec_free(itd->class); g_free(it->data); }
M openbox/config.hopenbox/config.h

@@ -38,6 +38,7 @@ {

GPatternSpec *class; GPatternSpec *name; GPatternSpec *role; + GPatternSpec *title; ObClientType type; GravityPoint position;
M openbox/screen.copenbox/screen.c

@@ -297,6 +297,7 @@ supported[i++] = OBT_PROP_ATOM(OB_CONFIG_FILE);

supported[i++] = OBT_PROP_ATOM(OB_CONTROL); supported[i++] = OBT_PROP_ATOM(OB_VERSION); supported[i++] = OBT_PROP_ATOM(OB_APP_ROLE); + supported[i++] = OBT_PROP_ATOM(OB_APP_TITLE); supported[i++] = OBT_PROP_ATOM(OB_APP_NAME); supported[i++] = OBT_PROP_ATOM(OB_APP_CLASS); supported[i++] = OBT_PROP_ATOM(OB_APP_TYPE);