aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-04-03 14:37:00 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-04-03 15:18:57 -0400
commit1e549230db6b088aae2733e1084c7f953ff88abd (patch)
tree3b191c03bb68647198255d562d5d073fff5250f4 /sway/tree/workspace.c
parentMerge pull request #1684 from swaywm/follow-warp (diff)
downloadsway-1e549230db6b088aae2733e1084c7f953ff88abd.tar.gz
sway-1e549230db6b088aae2733e1084c7f953ff88abd.tar.zst
sway-1e549230db6b088aae2733e1084c7f953ff88abd.zip
Fix name generation for workspace number <name>
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c18
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);