From 3b88e41dd86468b21c202a5858a9362ca747a0b4 Mon Sep 17 00:00:00 2001 From: Antoine Date: Wed, 7 Aug 2019 22:43:01 -0700 Subject: [PATCH] =?UTF-8?q?move=20workspace=20to=20output:=20don=E2=80=99t?= =?UTF-8?q?=20create=20duplicatively=20numbered=20workspaces=20(#3746)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #3745 --- src/workspace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/workspace.c b/src/workspace.c index 59705798..4f618751 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -983,11 +983,15 @@ void workspace_move_to_output(Con *ws, Output *output) { bool used_assignment = false; struct Workspace_Assignment *assignment; TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) { + bool attached; + int num; if (!output_triggers_assignment(current_output, assignment)) { continue; } - /* check if this workspace is already attached to the tree */ - if (get_existing_workspace_by_name(assignment->name) != NULL) { + /* check if this workspace's name or num is already attached to the tree */ + num = ws_name_to_number(assignment->name); + attached = ((num == -1) ? get_existing_workspace_by_name(assignment->name) : get_existing_workspace_by_num(num)) != NULL; + if (attached) { continue; }