From: Mikael Magnusson Date: Sat, 1 Mar 2008 15:42:06 +0000 (+0100) Subject: Let the If action match window titles. X-Git-Tag: mikabox-3.4.7.2~57^2~5 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=dd0e72354cbdd6aa947c5f6c1b0a5cd3a6a800db;p=mikachu%2Fopenbox.git Let the If action match window titles. --- diff --git a/openbox/actions/if.c b/openbox/actions/if.c index 63a7fbcd..0bd75afc 100644 --- a/openbox/actions/if.c +++ b/openbox/actions/if.c @@ -19,6 +19,7 @@ typedef struct { gboolean iconic_off; gboolean focused; gboolean unfocused; + GPatternSpec *matchtitle; GSList *thenacts; GSList *elseacts; } Options; @@ -75,6 +76,13 @@ static gpointer setup_func(xmlNodePtr node) else o->unfocused = TRUE; } + if ((n = obt_parse_find_node(node, "title"))) { + gchar *s; + if ((s = obt_parse_node_string(n))) { + o->matchtitle = g_pattern_spec_new(s); + g_free(s); + } + } if ((n = obt_parse_find_node(node, "then"))) { xmlNodePtr m; @@ -112,6 +120,8 @@ static void free_func(gpointer options) actions_act_unref(o->elseacts->data); o->elseacts = g_slist_delete_link(o->elseacts, o->elseacts); } + if (o->matchtitle) + g_pattern_spec_free(o->matchtitle); g_free(o); } @@ -134,7 +144,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) (!o->maxfull_on || (c && c->max_vert && c->max_horz)) && (!o->maxfull_off || (c && !(c->max_vert && c->max_horz))) && (!o->focused || (c && (c == focus_client))) && - (!o->unfocused || (c && !(c == focus_client)))) + (!o->unfocused || (c && !(c == focus_client))) && + (!o->matchtitle || + (g_pattern_match_string(o->matchtitle, c->original_title)))) { acts = o->thenacts; }