/* this container swallows dock clients */
Match *match = scalloc(sizeof(Match));
match_init(match);
- match->dock = true;
+ match->dock = M_DOCK_TOP;
match->insert_where = M_BELOW;
TAILQ_INSERT_TAIL(&(topdock->swallow_head), match, matches);
DLOG("attaching\n");
con_attach(topdock, con, false);
+ /* content container */
+
DLOG("adding main content container\n");
Con *content = con_new(NULL);
content->type = CT_CON;
FREE(name);
con_attach(content, con, false);
+ /* bottom dock container */
+ Con *bottomdock = con_new(NULL);
+ bottomdock->type = CT_DOCKAREA;
+ bottomdock->layout = L_DOCKAREA;
+ bottomdock->orientation = VERT;
+ /* this container swallows dock clients */
+ match = scalloc(sizeof(Match));
+ match_init(match);
+ match->dock = M_DOCK_BOTTOM;
+ match->insert_where = M_BELOW;
+ TAILQ_INSERT_TAIL(&(bottomdock->swallow_head), match, matches);
+
+ bottomdock->name = sstrdup("bottomdock");
+
+ asprintf(&name, "[i3 con] bottom dockarea %s", con->name);
+ x_set_name(bottomdock, name);
+ FREE(name);
+ DLOG("attaching\n");
+ con_attach(bottomdock, con, false);
+
DLOG("Now adding a workspace\n");
/* add a workspace to this output */
int c = 0;
bool exists = true;
while (exists) {
- Con *out, *current;
+ Con *out, *current, *child;
c++;
exists = false;
TAILQ_FOREACH(out, &(croot->nodes_head), nodes) {
TAILQ_FOREACH(current, &(out->nodes_head), nodes) {
- if (strcasecmp(current->name, ws->name) != 0)
+ if (current->type != CT_CON)
continue;
- exists = true;
- break;
+ TAILQ_FOREACH(child, &(current->nodes_head), nodes) {
+ if (strcasecmp(child->name, ws->name) != 0)
+ continue;
+
+ exists = true;
+ break;
+ }
}
}
DLOG("Output %s disabled, re-assigning workspaces/docks\n", output->name);
if ((first = get_first_output()) == NULL)
- die("No usable outputs available\n");
+ die("No usable outputs available\n");
+
+ Con *first_content = output_get_content(first->con);
if (output->con != NULL) {
/* We need to move the workspaces from the disappearing output to the first output */
/* 2: iterate through workspaces and re-assign them */
Con *current;
- while (!TAILQ_EMPTY(&(output->con->nodes_head))) {
- current = TAILQ_FIRST(&(output->con->nodes_head));
+ Con *old_content = output_get_content(output->con);
+ while (!TAILQ_EMPTY(&(old_content->nodes_head))) {
+ current = TAILQ_FIRST(&(old_content->nodes_head));
DLOG("Detaching current = %p / %s\n", current, current->name);
con_detach(current);
DLOG("Re-attaching current = %p / %s\n", current, current->name);
- con_attach(current, first->con, false);
+ con_attach(current, first_content, false);
DLOG("Done, next\n");
}
DLOG("re-attached all workspaces\n");