]> git.sur5r.net Git - i3/i3/blobdiff - src/assignments.c
fix transition from named to numbered workspace
[i3/i3] / src / assignments.c
index 9de50e120220f5fd74d1f28bd6354e9ae7e49309..6c563357d14c5adb6fabd100a0230d4f7bf565f4 100644 (file)
@@ -40,6 +40,13 @@ void run_assignments(i3Window *window) {
         if (skip)
             continue;
 
+        /* Store that we ran this assignment to not execute it again. We have
+         * to do this before running the actual command to prevent infinite
+         * loops. */
+        window->nr_assignments++;
+        window->ran_assignments = srealloc(window->ran_assignments, sizeof(Assignment *) * window->nr_assignments);
+        window->ran_assignments[window->nr_assignments - 1] = current;
+
         DLOG("matching assignment, would do:\n");
         if (current->type == A_COMMAND) {
             DLOG("execute command %s\n", current->dest.command);
@@ -53,11 +60,6 @@ void run_assignments(i3Window *window) {
 
             command_result_free(result);
         }
-
-        /* Store that we ran this assignment to not execute it again */
-        window->nr_assignments++;
-        window->ran_assignments = srealloc(window->ran_assignments, sizeof(Assignment *) * window->nr_assignments);
-        window->ran_assignments[window->nr_assignments - 1] = current;
     }
 
     /* If any of the commands required re-rendering, we will do that now. */