From aaa0923bc4fe4ffda114482a9b8023c90c26c8dc Mon Sep 17 00:00:00 2001 From: taiyu Date: Thu, 10 Sep 2015 11:07:40 -0700 Subject: cmd status + workspace ws output op --- sway/workspace.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'sway/workspace.c') diff --git a/sway/workspace.c b/sway/workspace.c index 7eb422c4..658f79bc 100644 --- a/sway/workspace.c +++ b/sway/workspace.c @@ -76,7 +76,26 @@ char *workspace_next_name(void) { } swayc_t *workspace_create(const char* name) { - swayc_t *parent = get_focused_container(&root_container); + swayc_t *parent; + // Search for workspace<->output pair + int i, e = config->workspace_outputs->length; + for (i = 0; i < e; ++i) { + struct workspace_output *wso = config->workspace_outputs->items[i]; + if (strcasecmp(wso->workspace, name) == 0) + { + // Find output to use if it exists + e = root_container.children->length; + for (i = 0; i < e; ++i) { + parent = root_container.children->items[i]; + if (strcmp(parent->name, wso->output) == 0) { + return new_workspace(parent, name); + } + } + break; + } + } + // Otherwise create a new one + parent = get_focused_container(&root_container); parent = swayc_parent_by_type(parent, C_OUTPUT); return new_workspace(parent, name); } -- cgit v1.2.3