]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: store and properly load workspace order when restarting
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 27 Dec 2010 21:28:59 +0000 (22:28 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 27 Dec 2010 21:28:59 +0000 (22:28 +0100)
src/ipc.c
src/load_layout.c

index 3954107f2dd3b22d836201f9b9c0adc8435c79f7..f953f9aebd5c3aa1159510bce726e13d71ccdf65 100644 (file)
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -201,6 +201,11 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
     ystr("name");
     ystr(con->name);
 
+    if (con->type == CT_WORKSPACE) {
+        ystr("num");
+        y(integer, con->num);
+    }
+
     ystr("window");
     if (con->window)
         y(integer, con->window->id);
index 60a6331389f654490119c9339b90b46cb3dc11bb..8d532da4fb8ea51293a211364962f718cecec87c 100644 (file)
@@ -34,7 +34,9 @@ static int json_start_map(void *ctx) {
                 TAILQ_INSERT_TAIL(&(ws->floating_head), json_node, floating_windows);
                 TAILQ_INSERT_TAIL(&(ws->focus_head), json_node, focused);
             } else {
-                json_node = con_new(json_node);
+                Con *parent = json_node;
+                json_node = con_new(NULL);
+                json_node->parent = parent;
             }
         }
     }
@@ -43,8 +45,11 @@ static int json_start_map(void *ctx) {
 
 static int json_end_map(void *ctx) {
     LOG("end of map\n");
-    if (!parsing_swallows && !parsing_rect && !parsing_window_rect)
+    if (!parsing_swallows && !parsing_rect && !parsing_window_rect) {
+        LOG("attaching\n");
+        con_attach(json_node, json_node->parent, false);
         json_node = json_node->parent;
+    }
     if (parsing_rect)
         parsing_rect = false;
     if (parsing_window_rect)
@@ -113,6 +118,9 @@ static int json_int(void *ctx, long val) {
         to_focus = json_node;
     }
 
+    if (strcasecmp(last_key, "num") == 0)
+        json_node->num = val;
+
     if (parsing_rect || parsing_window_rect) {
         Rect *r = (parsing_rect ? &(json_node->rect) : &(json_node->window_rect));
         if (strcasecmp(last_key, "x") == 0)