From: Michael Stapelberg Date: Wed, 4 Mar 2009 21:52:36 +0000 (+0100) Subject: Implement auto-destroying of empty workspaces X-Git-Tag: 3.a~97 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=91f98cc59734b1d6575d318de1346ef09507db2a;p=i3%2Fi3 Implement auto-destroying of empty workspaces --- diff --git a/src/commands.c b/src/commands.c index 394bc91e..948e8710 100644 --- a/src/commands.c +++ b/src/commands.c @@ -384,10 +384,17 @@ static void show_workspace(xcb_connection_t *conn, int workspace) { //xcb_grab_server(conn); /* Unmap all clients of the current workspace */ + int unmapped_clients = 0; for (int cols = 0; cols < c_ws->cols; cols++) for (int rows = 0; rows < c_ws->rows; rows++) - CIRCLEQ_FOREACH(client, &(c_ws->table[cols][rows]->clients), clients) + CIRCLEQ_FOREACH(client, &(c_ws->table[cols][rows]->clients), clients) { xcb_unmap_window(conn, client->frame); + unmapped_clients++; + } + + /* If we did not unmap any clients, the workspace is empty and we can destroy it */ + if (unmapped_clients == 0) + c_ws->screen = NULL; /* Unmap the stack windows on the current workspace, if any */ struct Stack_Window *stack_win;