summaryrefslogtreecommitdiff
path: root/openbox/actions
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2013-08-19 03:25:40 +0200
committerMikael Magnusson <mikachu@gmail.com>2013-08-19 21:35:45 +0200
commit0a7ff45e4930a72968911325a019f0ea64b62a43 (patch)
tree770ff490ea4c85e78173b700985b5679ab31c4dc /openbox/actions
parent1d1fe5e6cc7afd8db05be7d4938ca87ba621dc94 (diff)
Add window type to If as well
This one required some extra helpers so is separate commit
Diffstat (limited to 'openbox/actions')
-rw-r--r--openbox/actions/if.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/openbox/actions/if.c b/openbox/actions/if.c
index 3d9f0e7f..a083d485 100644
--- a/openbox/actions/if.c
+++ b/openbox/actions/if.c
@@ -75,6 +75,7 @@ typedef struct {
TypedMatch class;
TypedMatch name;
TypedMatch role;
+ TypedMatch type;
} Query;
typedef struct {
@@ -153,7 +154,7 @@ static void free_typed_match(TypedMatch *tm)
}
}
-static gboolean check_typed_match(TypedMatch *tm, gchar *s)
+static gboolean check_typed_match(TypedMatch *tm, const gchar *s)
{
switch (tm->type) {
case MATCH_TYPE_PATTERN:
@@ -212,6 +213,9 @@ static void setup_query(Options* o, xmlNodePtr node, QueryTarget target) {
if ((n = obt_xml_find_node(node, "role"))) {
setup_typed_match(&q->role, n);
}
+ if ((n = obt_xml_find_node(node, "type"))) {
+ setup_typed_match(&q->type, n);
+ }
if ((n = obt_xml_find_node(node, "monitor"))) {
q->client_monitor = obt_xml_node_int(n);
}
@@ -283,6 +287,7 @@ static void free_func(gpointer options)
free_typed_match(&q->class);
free_typed_match(&q->name);
free_typed_match(&q->role);
+ free_typed_match(&q->type);
g_slice_free(Query, q);
}
@@ -398,6 +403,8 @@ static gboolean run_func_if(ObActionsData *data, gpointer options)
is_true &= check_typed_match(&q->class, query_target->class);
is_true &= check_typed_match(&q->name, query_target->name);
is_true &= check_typed_match(&q->role, query_target->role);
+ is_true &= check_typed_match(&q->type,
+ client_type_to_string(query_target));
if (q->client_monitor)
is_true &= client_monitor(query_target) == q->client_monitor - 1;