X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fmanage.c;h=e35965481a9cb046b971c1717a3f8fb963316607;hb=eaf7a49e28b7ff8e1820a1b23350647574a0ed5a;hp=86a361c376a856a32d6a1d90c51178dbec163e12;hpb=a3013969976c0f2572e6137f8a6b0ed306287b5e;p=i3%2Fi3 diff --git a/src/manage.c b/src/manage.c index 86a361c3..e3596548 100644 --- a/src/manage.c +++ b/src/manage.c @@ -259,9 +259,26 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki Con *wm_desktop_ws = NULL; /* If not, check if it is assigned to a specific workspace */ - if ((assignment = assignment_for(cwindow, A_TO_WORKSPACE))) { + if ((assignment = assignment_for(cwindow, A_TO_WORKSPACE)) || + (assignment = assignment_for(cwindow, A_TO_WORKSPACE_NUMBER))) { DLOG("Assignment matches (%p)\n", match); - Con *assigned_ws = workspace_get(assignment->dest.workspace, NULL); + + Con *assigned_ws = NULL; + if (assignment->type == A_TO_WORKSPACE_NUMBER) { + Con *output = NULL; + long parsed_num = ws_name_to_number(assignment->dest.workspace); + + /* This will only work for workspaces that already exist. */ + TAILQ_FOREACH(output, &(croot->nodes_head), nodes) { + GREP_FIRST(assigned_ws, output_get_content(output), child->num == parsed_num); + } + } + /* A_TO_WORKSPACE type assignment or fallback from A_TO_WORKSPACE_NUMBER + * when the target workspace number does not exist yet. */ + if (!assigned_ws) { + assigned_ws = workspace_get(assignment->dest.workspace, NULL); + } + nc = con_descend_tiling_focused(assigned_ws); DLOG("focused on ws %s: %p / %s\n", assigned_ws->name, nc, nc->name); if (nc->type == CT_WORKSPACE)