i3 - improved tiling WM


Respect workspace numbers when looking for a free workspace

Patch status: needinfo

Patch by Sebastian Ullrich

To apply this patch, use:
curl http://cr.i3wm.org/patch/200/raw.patch | git am

b/src/workspace.c

13
@@ -197,17 +197,20 @@ Con *create_workspace_on_output(Output *output, Con *content) {
14
         while (exists) {
15
             c++;
16
 
17
+            ws->num = c;
18
             FREE(ws->name);
19
             sasprintf(&(ws->name), "%d", c);
20
 
21
             current = NULL;
22
             TAILQ_FOREACH(out, &(croot->nodes_head), nodes)
23
                 GREP_FIRST(current, output_get_content(out), !strcasecmp(child->name, ws->name));
24
+            if (current == NULL)
25
+                TAILQ_FOREACH(out, &(croot->nodes_head), nodes)
26
+                    GREP_FIRST(current, output_get_content(out), child->num == ws->num);
27
             exists = (current != NULL);
28
 
29
             DLOG("result for ws %s / %d: exists = %d\n", ws->name, c, exists);
30
         }
31
-        ws->num = c;
32
     }
33
     con_attach(ws, content, false);
34