diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-04-03 14:37:00 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-04-03 15:18:57 -0400 |
commit | 1e549230db6b088aae2733e1084c7f953ff88abd (patch) | |
tree | 3b191c03bb68647198255d562d5d073fff5250f4 | |
parent | Merge pull request #1684 from swaywm/follow-warp (diff) | |
download | sway-1e549230db6b088aae2733e1084c7f953ff88abd.tar.gz sway-1e549230db6b088aae2733e1084c7f953ff88abd.tar.zst sway-1e549230db6b088aae2733e1084c7f953ff88abd.zip |
Fix name generation for workspace number <name>
-rw-r--r-- | sway/tree/workspace.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index c629f1f1..d6fd7c70 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -87,6 +87,24 @@ char *workspace_next_name(const char *output_name) { | |||
87 | continue; | 87 | continue; |
88 | } | 88 | } |
89 | 89 | ||
90 | // If the command is workspace number <name>, isolate the name | ||
91 | if (strncmp(_target, "number ", strlen("number ")) == 0) { | ||
92 | size_t length = strlen(_target) - strlen("number ") + 1; | ||
93 | char *temp = malloc(length); | ||
94 | strncpy(temp, _target + strlen("number "), length - 1); | ||
95 | temp[length - 1] = '\0'; | ||
96 | free(_target); | ||
97 | _target = temp; | ||
98 | wlr_log(L_DEBUG, "Isolated name from workspace number: '%s'", _target); | ||
99 | |||
100 | // Make sure the workspace number doesn't already exist | ||
101 | if (workspace_by_number(_target)) { | ||
102 | free(_target); | ||
103 | free(dup); | ||
104 | continue; | ||
105 | } | ||
106 | } | ||
107 | |||
90 | // Make sure that the workspace doesn't already exist | 108 | // Make sure that the workspace doesn't already exist |
91 | if (workspace_by_name(_target)) { | 109 | if (workspace_by_name(_target)) { |
92 | free(_target); | 110 | free(_target); |