diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-09-10 14:18:56 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-09-10 14:18:56 -0400 |
commit | f5343adae4d631e4cdade7869b4d73fc97b4ac5f (patch) | |
tree | 7c12a435bf56e4ebfcae689ce46280eeeb330346 /sway/workspace.c | |
parent | 6388241abb7e2e66e716fc128e658d3d3419442a (diff) | |
parent | aaa0923bc4fe4ffda114482a9b8023c90c26c8dc (diff) |
Merge pull request #177 from taiyu-len/master
cmd status + workspace ws output op
Diffstat (limited to 'sway/workspace.c')
-rw-r--r-- | sway/workspace.c | 21 |
1 files changed, 20 insertions, 1 deletions
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); } |