diff options
author | Aaron Ouellette <aouellette2016@gmail.com> | 2016-03-18 17:09:11 -0400 |
---|---|---|
committer | Aaron Ouellette <aouellette2016@gmail.com> | 2016-03-18 17:09:11 -0400 |
commit | 8af6a419ec6f4cfc596aabd5c820e7033cc760c4 (patch) | |
tree | d958fae88ea43df2e707830e5f6ca9bf6975a491 /sway/workspace.c | |
parent | 133009b652e794bee083dbeb2fbdd2db787e84c6 (diff) | |
parent | 378a45cec23b76732a19d0027e1bba3ef2bf3752 (diff) | |
download | sway-8af6a419ec6f4cfc596aabd5c820e7033cc760c4.tar.xz |
Merge branch 'master' of git://github.com/SirCmpwn/sway into swaylock
Diffstat (limited to 'sway/workspace.c')
-rw-r--r-- | sway/workspace.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sway/workspace.c b/sway/workspace.c index ad989de9..90edc6e9 100644 --- a/sway/workspace.c +++ b/sway/workspace.c @@ -25,8 +25,22 @@ struct workspace_by_number_data { const char *name; }; -char *workspace_next_name(void) { - sway_log(L_DEBUG, "Workspace: Generating new name"); +static bool workspace_valid_on_output(const char *output_name, const char *ws_name) { + int i; + for (i = 0; i < config->workspace_outputs->length; ++i) { + struct workspace_output *wso = config->workspace_outputs->items[i]; + if (strcasecmp(wso->workspace, ws_name) == 0) { + if (strcasecmp(wso->output, output_name) != 0) { + return false; + } + } + } + + return true; +} + +char *workspace_next_name(const char *output_name) { + sway_log(L_DEBUG, "Workspace: Generating new workspace name for output %s", output_name); int i; int l = 1; // Scan all workspace bindings to find the next available workspace name, @@ -73,6 +87,14 @@ char *workspace_next_name(void) { free(_target); continue; } + + // make sure that the workspace can appear on the given + // output + if (!workspace_valid_on_output(output_name, _target)) { + free(_target); + continue; + } + if (binding->order < order) { order = binding->order; target = _target; |