diff options
author | taiyu <taiyu.len@gmail.com> | 2015-09-10 11:07:40 -0700 |
---|---|---|
committer | taiyu <taiyu.len@gmail.com> | 2015-09-10 11:07:40 -0700 |
commit | aaa0923bc4fe4ffda114482a9b8023c90c26c8dc (patch) | |
tree | 7c12a435bf56e4ebfcae689ce46280eeeb330346 /sway/workspace.c | |
parent | mode supports multi token names (diff) | |
download | sway-aaa0923bc4fe4ffda114482a9b8023c90c26c8dc.tar.gz sway-aaa0923bc4fe4ffda114482a9b8023c90c26c8dc.tar.zst sway-aaa0923bc4fe4ffda114482a9b8023c90c26c8dc.zip |
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) { | |||
76 | } | 76 | } |
77 | 77 | ||
78 | swayc_t *workspace_create(const char* name) { | 78 | swayc_t *workspace_create(const char* name) { |
79 | swayc_t *parent = get_focused_container(&root_container); | 79 | swayc_t *parent; |
80 | // Search for workspace<->output pair | ||
81 | int i, e = config->workspace_outputs->length; | ||
82 | for (i = 0; i < e; ++i) { | ||
83 | struct workspace_output *wso = config->workspace_outputs->items[i]; | ||
84 | if (strcasecmp(wso->workspace, name) == 0) | ||
85 | { | ||
86 | // Find output to use if it exists | ||
87 | e = root_container.children->length; | ||
88 | for (i = 0; i < e; ++i) { | ||
89 | parent = root_container.children->items[i]; | ||
90 | if (strcmp(parent->name, wso->output) == 0) { | ||
91 | return new_workspace(parent, name); | ||
92 | } | ||
93 | } | ||
94 | break; | ||
95 | } | ||
96 | } | ||
97 | // Otherwise create a new one | ||
98 | parent = get_focused_container(&root_container); | ||
80 | parent = swayc_parent_by_type(parent, C_OUTPUT); | 99 | parent = swayc_parent_by_type(parent, C_OUTPUT); |
81 | return new_workspace(parent, name); | 100 | return new_workspace(parent, name); |
82 | } | 101 | } |