Add screendesktop to If
authorMikael Magnusson <mikachu@gmail.com>
Sat, 9 Oct 2010 22:41:10 +0000 (00:41 +0200)
committerMikael Magnusson <mikachu@gmail.com>
Thu, 18 Apr 2013 10:38:58 +0000 (12:38 +0200)
Conflicts:
openbox/actions/if.c

openbox/actions/if.c

index 68beb9f816197e837026f6f9a4a5c531575ee95a..6ac2540983e3124dd00080625f9b9f8c4551385d 100644 (file)
@@ -30,6 +30,7 @@ typedef struct {
     gboolean desktop_current;
     gboolean desktop_other;
     guint    desktop_number;
+    guint    screendesktop_number;
     GPatternSpec *matchtitle;
     GRegex *regextitle;
     GSList *thenacts;
@@ -119,13 +120,13 @@ static gpointer setup_func(xmlNodePtr node)
     if ((n = obt_xml_find_node(node, "desktop"))) {
         gchar *s;
         if ((s = obt_xml_node_string(n))) {
-          if (!g_ascii_strcasecmp(s, "current"))
-              o->desktop_current = TRUE;
-          if (!g_ascii_strcasecmp(s, "other"))
-              o->desktop_other = TRUE;
-          else
-              o->desktop_number = atoi(s);
-          g_free(s);
+            if (!g_ascii_strcasecmp(s, "current"))
+                o->desktop_current = TRUE;
+            if (!g_ascii_strcasecmp(s, "other"))
+                o->desktop_other = TRUE;
+            else
+                o->desktop_number = atoi(s);
+            g_free(s);
         }
     }
     if ((n = obt_xml_find_node(node, "omnipresent"))) {
@@ -133,6 +134,12 @@ static gpointer setup_func(xmlNodePtr node)
             o->omnipresent_on = TRUE;
         else
             o->omnipresent_off = TRUE;
+    if ((n = obt_xml_find_node(node, "screendesktop"))) {
+        gchar *s;
+        if ((s = obt_xml_node_string(n))) {
+          o->screendesktop_number = atoi(s);
+          g_free(s);
+        }
     }
     if ((n = obt_xml_find_node(node, "title"))) {
         gchar *s;
@@ -227,6 +234,7 @@ static gboolean run_func_if(ObActionsData *data, gpointer options)
                                  (c->desktop != DESKTOP_ALL))) &&
         (!o->desktop_number  || ((c->desktop == o->desktop_number - 1) ||
                                  (c->desktop == DESKTOP_ALL))) &&
+        (!o->screendesktop_number || screen_desktop == o->screendesktop_number - 1) &&
         (!o->matchtitle ||
          (g_pattern_match_string(o->matchtitle, c->original_title))) &&
         (!o->regextitle ||