diff options
author | 2018-09-05 09:33:27 -0400 | |
---|---|---|
committer | 2018-09-05 09:33:27 -0400 | |
commit | 610eb946171f782165a20614b2d3318b89273990 (patch) | |
tree | 05eec1df1ef48e05b23d273d31143ad32e7632d2 /sway/commands/rename.c | |
parent | Merge pull request #2574 from ammgws/block-bg-fix (diff) | |
parent | Allow marked containers to be moved out of the scratchpad via move command (diff) | |
download | sway-610eb946171f782165a20614b2d3318b89273990.tar.gz sway-610eb946171f782165a20614b2d3318b89273990.tar.zst sway-610eb946171f782165a20614b2d3318b89273990.zip |
Merge pull request #2540 from RyanDwyer/typesafety
Implement type safe arguments and demote sway_container
Diffstat (limited to 'sway/commands/rename.c')
-rw-r--r-- | sway/commands/rename.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sway/commands/rename.c b/sway/commands/rename.c index 21d2aa64..d982f941 100644 --- a/sway/commands/rename.c +++ b/sway/commands/rename.c | |||
@@ -25,14 +25,11 @@ struct cmd_results *cmd_rename(int argc, char **argv) { | |||
25 | } | 25 | } |
26 | 26 | ||
27 | int argn = 1; | 27 | int argn = 1; |
28 | struct sway_container *workspace; | 28 | struct sway_workspace *workspace = NULL; |
29 | 29 | ||
30 | if (strcasecmp(argv[1], "to") == 0) { | 30 | if (strcasecmp(argv[1], "to") == 0) { |
31 | // 'rename workspace to new_name' | 31 | // 'rename workspace to new_name' |
32 | workspace = config->handler_context.current_container; | 32 | workspace = config->handler_context.workspace; |
33 | if (workspace->type != C_WORKSPACE) { | ||
34 | workspace = container_parent(workspace, C_WORKSPACE); | ||
35 | } | ||
36 | } else if (strcasecmp(argv[1], "number") == 0) { | 33 | } else if (strcasecmp(argv[1], "number") == 0) { |
37 | // 'rename workspace number x to new_name' | 34 | // 'rename workspace number x to new_name' |
38 | if (!isdigit(argv[2][0])) { | 35 | if (!isdigit(argv[2][0])) { |
@@ -78,7 +75,7 @@ struct cmd_results *cmd_rename(int argc, char **argv) { | |||
78 | return cmd_results_new(CMD_INVALID, "rename", | 75 | return cmd_results_new(CMD_INVALID, "rename", |
79 | "Cannot use special workspace name '%s'", argv[argn]); | 76 | "Cannot use special workspace name '%s'", argv[argn]); |
80 | } | 77 | } |
81 | struct sway_container *tmp_workspace = workspace_by_name(new_name); | 78 | struct sway_workspace *tmp_workspace = workspace_by_name(new_name); |
82 | if (tmp_workspace) { | 79 | if (tmp_workspace) { |
83 | free(new_name); | 80 | free(new_name); |
84 | return cmd_results_new(CMD_INVALID, "rename", | 81 | return cmd_results_new(CMD_INVALID, "rename", |
@@ -89,7 +86,7 @@ struct cmd_results *cmd_rename(int argc, char **argv) { | |||
89 | free(workspace->name); | 86 | free(workspace->name); |
90 | workspace->name = new_name; | 87 | workspace->name = new_name; |
91 | 88 | ||
92 | output_sort_workspaces(workspace->parent); | 89 | output_sort_workspaces(workspace->output); |
93 | ipc_event_workspace(NULL, workspace, "rename"); | 90 | ipc_event_workspace(NULL, workspace, "rename"); |
94 | 91 | ||
95 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 92 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |