diff options
Diffstat (limited to 'sway/commands/kill.c')
-rw-r--r-- | sway/commands/kill.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/sway/commands/kill.c b/sway/commands/kill.c index f6774767..46d6e98e 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c | |||
@@ -3,21 +3,28 @@ | |||
3 | #include "sway/input/input-manager.h" | 3 | #include "sway/input/input-manager.h" |
4 | #include "sway/input/seat.h" | 4 | #include "sway/input/seat.h" |
5 | #include "sway/tree/view.h" | 5 | #include "sway/tree/view.h" |
6 | #include "sway/tree/container.h" | ||
6 | #include "sway/commands.h" | 7 | #include "sway/commands.h" |
7 | 8 | ||
8 | struct cmd_results *cmd_kill(int argc, char **argv) { | 9 | struct cmd_results *cmd_kill(int argc, char **argv) { |
9 | enum sway_container_type type = config->handler_context.current_container->type; | 10 | struct sway_container *con = |
10 | if (type != C_VIEW && type != C_CONTAINER) { | 11 | config->handler_context.current_container; |
12 | |||
13 | switch (con->type) { | ||
14 | case C_ROOT: | ||
15 | case C_OUTPUT: | ||
16 | case C_WORKSPACE: | ||
17 | case C_TYPES: | ||
11 | return cmd_results_new(CMD_INVALID, NULL, | 18 | return cmd_results_new(CMD_INVALID, NULL, |
12 | "Can only kill views and containers with this command"); | 19 | "Can only kill views and containers with this command"); |
13 | } | 20 | break; |
14 | 21 | case C_CONTAINER: | |
15 | // TODO close arbitrary containers without a view | 22 | con = container_destroy(con); |
16 | struct sway_view *view = | 23 | arrange_windows(con, -1, -1); |
17 | config->handler_context.current_container->sway_view; | 24 | break; |
18 | 25 | case C_VIEW: | |
19 | if (view) { | 26 | view_close(con->sway_view); |
20 | view_close(view); | 27 | break; |
21 | } | 28 | } |
22 | 29 | ||
23 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 30 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |