diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-03-31 00:44:17 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-03-31 15:37:16 -0400 |
commit | 7706d83160267be61accb1b6f7bdc2f43299cae7 (patch) | |
tree | 64b9751ee7edf613c9e3a06d1f5446501f4ddbaf /sway/commands/kill.c | |
parent | Merge pull request #1684 from swaywm/follow-warp (diff) | |
download | sway-7706d83160267be61accb1b6f7bdc2f43299cae7.tar.gz sway-7706d83160267be61accb1b6f7bdc2f43299cae7.tar.zst sway-7706d83160267be61accb1b6f7bdc2f43299cae7.zip |
basic split containers
Diffstat (limited to 'sway/commands/kill.c')
-rw-r--r-- | sway/commands/kill.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/sway/commands/kill.c b/sway/commands/kill.c index f6774767..80120832 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c | |||
@@ -3,21 +3,30 @@ | |||
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: | ||
11 | return cmd_results_new(CMD_INVALID, NULL, | 17 | return cmd_results_new(CMD_INVALID, NULL, |
12 | "Can only kill views and containers with this command"); | 18 | "Can only kill views and containers with this command"); |
13 | } | 19 | break; |
14 | 20 | case C_CONTAINER: | |
15 | // TODO close arbitrary containers without a view | 21 | con = container_destroy(con); |
16 | struct sway_view *view = | 22 | con = container_reap_empty(con); |
17 | config->handler_context.current_container->sway_view; | 23 | arrange_windows(con, -1, -1); |
18 | 24 | break; | |
19 | if (view) { | 25 | case C_VIEW: |
20 | view_close(view); | 26 | view_close(con->sway_view); |
27 | break; | ||
28 | default: | ||
29 | break; | ||
21 | } | 30 | } |
22 | 31 | ||
23 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 32 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |