From: Michael Stapelberg Date: Mon, 14 Feb 2011 15:43:41 +0000 (+0100) Subject: Automatically close empty parent cons when making their last child floating (Thanks... X-Git-Tag: tree-pr2~58 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a5e075c154aadb77790b1d76395a2bffd24f745d;p=i3%2Fi3 Automatically close empty parent cons when making their last child floating (Thanks mseed) This fixes #313 --- diff --git a/src/floating.c b/src/floating.c index c912dc71..25afa832 100644 --- a/src/floating.c +++ b/src/floating.c @@ -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);