diff options
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sway/container.c b/sway/container.c index f10fbecf..3534721d 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdbool.h> | 2 | #include <stdbool.h> |
3 | #include <strings.h> | 3 | #include <strings.h> |
4 | #include "config.h" | ||
4 | #include "container.h" | 5 | #include "container.h" |
5 | #include "workspace.h" | 6 | #include "workspace.h" |
6 | #include "layout.h" | 7 | #include "layout.h" |
@@ -63,14 +64,28 @@ swayc_t *new_output(wlc_handle handle) { | |||
63 | container_map(&root_container, add_output_widths, &total_width); | 64 | container_map(&root_container, add_output_widths, &total_width); |
64 | 65 | ||
65 | //Create workspace | 66 | //Create workspace |
66 | char *ws_name = workspace_next_name(); | 67 | char *ws_name = NULL; |
68 | if (name) { | ||
69 | int i; | ||
70 | for (i = 0; i < config->workspace_outputs->length; ++i) { | ||
71 | struct workspace_output *wso = config->workspace_outputs->items[i]; | ||
72 | if (strcasecmp(wso->output, name) == 0) { | ||
73 | sway_log(L_DEBUG, "Matched workspace to output: %s for %s", wso->workspace, wso->output); | ||
74 | ws_name = strdup(wso->workspace); | ||
75 | break; | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | if (!ws_name) { | ||
80 | ws_name = workspace_next_name(); | ||
81 | } | ||
67 | new_workspace(output, ws_name); | 82 | new_workspace(output, ws_name); |
68 | free(ws_name); | 83 | free(ws_name); |
69 | 84 | ||
70 | return output; | 85 | return output; |
71 | } | 86 | } |
72 | 87 | ||
73 | swayc_t *new_workspace(swayc_t * output, const char *name) { | 88 | swayc_t *new_workspace(swayc_t *output, const char *name) { |
74 | sway_log(L_DEBUG, "Added workspace %s for output %u", name, (unsigned int)output->handle); | 89 | sway_log(L_DEBUG, "Added workspace %s for output %u", name, (unsigned int)output->handle); |
75 | swayc_t *workspace = new_swayc(C_WORKSPACE); | 90 | swayc_t *workspace = new_swayc(C_WORKSPACE); |
76 | 91 | ||