Add matching which monitor the client is on in the If action (Bug 5426)
authorMikael Magnusson <mikachu@gmail.com>
Sun, 11 Aug 2013 13:47:31 +0000 (15:47 +0200)
committerDana Jansens <danakj@orodu.net>
Sun, 11 Aug 2013 17:41:38 +0000 (13:41 -0400)
openbox/actions/if.c

index 7087d6a..fd1280d 100644 (file)
@@ -29,6 +29,7 @@ typedef struct {
     gboolean desktop_other;
     guint    desktop_number;
     guint    screendesktop_number;
     gboolean desktop_other;
     guint    desktop_number;
     guint    screendesktop_number;
+    guint    client_monitor;
     GPatternSpec *matchtitle;
     GRegex *regextitle;
     gchar  *plaintitle;
     GPatternSpec *matchtitle;
     GRegex *regextitle;
     gchar  *plaintitle;
@@ -107,6 +108,9 @@ static gpointer setup_func(xmlNodePtr node)
             g_free(s);
         }
     }
             g_free(s);
         }
     }
+    if ((n = obt_xml_find_node(node, "monitor"))) {
+        o->client_monitor = obt_xml_node_int(n);
+    }
 
     if ((n = obt_xml_find_node(node, "then"))) {
         xmlNodePtr m;
 
     if ((n = obt_xml_find_node(node, "then"))) {
         xmlNodePtr m;
@@ -192,7 +196,9 @@ static gboolean run_func(ObActionsData *data, gpointer options)
         (!o->regextitle ||
          (g_regex_match(o->regextitle, c->original_title, 0, NULL))) &&
         (!o->plaintitle ||
         (!o->regextitle ||
          (g_regex_match(o->regextitle, c->original_title, 0, NULL))) &&
         (!o->plaintitle ||
-         (!strcmp(o->plaintitle, c->original_title))))
+         (!strcmp(o->plaintitle, c->original_title))) &&
+        (!o->client_monitor ||
+         (o->client_monitor == client_monitor(c) + 1)))
     {
         acts = o->thenacts;
     }
     {
         acts = o->thenacts;
     }