summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/commands/rename.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sway/commands/rename.c b/sway/commands/rename.c
index 29f90d81..491dbab0 100644
--- a/sway/commands/rename.c
+++ b/sway/commands/rename.c
@@ -81,8 +81,12 @@ struct cmd_results *cmd_rename(int argc, char **argv) {
81 struct sway_workspace *tmp_workspace = workspace_by_name(new_name); 81 struct sway_workspace *tmp_workspace = workspace_by_name(new_name);
82 if (tmp_workspace) { 82 if (tmp_workspace) {
83 free(new_name); 83 free(new_name);
84 return cmd_results_new(CMD_INVALID, "rename", 84 if (tmp_workspace == workspace) {
85 "Workspace already exists"); 85 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
86 } else {
87 return cmd_results_new(CMD_INVALID, "rename",
88 "Workspace already exists");
89 }
86 } 90 }
87 91
88 wlr_log(WLR_DEBUG, "renaming workspace '%s' to '%s'", workspace->name, new_name); 92 wlr_log(WLR_DEBUG, "renaming workspace '%s' to '%s'", workspace->name, new_name);