aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/rename.c
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2018-08-06 12:46:28 +0100
committerIan Fan <ianfan0@gmail.com>2018-08-06 14:17:58 +0100
commitf7c21451dfa7c4ffdce1307b5856707a0ed40405 (patch)
tree3df803a95c0a13f4dc9b627db505ba50d5e6a6d2 /sway/commands/rename.c
parent667b8dcb67d8c3f15b52f59d228bb3146a5cdb30 (diff)
commands: fix workspace edge cases
Diffstat (limited to 'sway/commands/rename.c')
-rw-r--r--sway/commands/rename.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sway/commands/rename.c b/sway/commands/rename.c
index a380ff9c..c6952bbb 100644
--- a/sway/commands/rename.c
+++ b/sway/commands/rename.c
@@ -61,6 +61,16 @@ struct cmd_results *cmd_rename(int argc, char **argv) {
}
char *new_name = join_args(argv + argn, argc - argn);
+ if (strcasecmp(new_name, "next") == 0 ||
+ strcasecmp(new_name, "prev") == 0 ||
+ strcasecmp(new_name, "next_on_output") == 0 ||
+ strcasecmp(new_name, "prev_on_output") == 0 ||
+ strcasecmp(new_name, "back_and_forth") == 0 ||
+ strcasecmp(new_name, "current") == 0) {
+ free(new_name);
+ return cmd_results_new(CMD_INVALID, "rename",
+ "Cannot use special workspace name '%s'", argv[argn]);
+ }
struct sway_container *tmp_workspace = workspace_by_name(new_name);
if (tmp_workspace) {
free(new_name);