]> git.sur5r.net Git - i3/i3/commitdiff
Automatically close empty parent cons when making their last child floating (Thanks...
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 14 Feb 2011 15:43:41 +0000 (16:43 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 14 Feb 2011 15:43:41 +0000 (16:43 +0100)
This fixes #313

src/floating.c

index c912dc713cdd53f4d2c47882c9242cda852c0a7f..25afa83213cdffeb87cf06f75ccfa644bccc67fc 100644 (file)
@@ -78,6 +78,12 @@ void floating_enable(Con *con, bool automatic) {
      * otherwise. */
     nc->parent = con_get_workspace(con);
 
+    /* check if the parent container is empty and close it if so */
+    if ((con->parent->type == CT_CON || con->parent->type == CT_FLOATING_CON) && con_num_children(con->parent) == 0) {
+        DLOG("Old container empty after setting this child to floating, closing\n");
+        tree_close(con->parent, false, false);
+    }
+
     char *name;
     asprintf(&name, "[i3 con] floatingcon around %p", con);
     x_set_name(nc, name);