aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/kill.c
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-03-31 00:44:17 -0400
committerTony Crisci <tony@dubstepdish.com>2018-03-31 15:37:16 -0400
commit7706d83160267be61accb1b6f7bdc2f43299cae7 (patch)
tree64b9751ee7edf613c9e3a06d1f5446501f4ddbaf /sway/commands/kill.c
parent122b96abed9955f78e3f157167d34312f5bb551d (diff)
basic split containers
Diffstat (limited to 'sway/commands/kill.c')
-rw-r--r--sway/commands/kill.c29
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 @@
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
#include "sway/tree/view.h"
+#include "sway/tree/container.h"
#include "sway/commands.h"
struct cmd_results *cmd_kill(int argc, char **argv) {
- enum sway_container_type type = config->handler_context.current_container->type;
- if (type != C_VIEW && type != C_CONTAINER) {
+ struct sway_container *con =
+ config->handler_context.current_container;
+
+ switch (con->type) {
+ case C_ROOT:
+ case C_OUTPUT:
+ case C_WORKSPACE:
return cmd_results_new(CMD_INVALID, NULL,
"Can only kill views and containers with this command");
- }
-
- // TODO close arbitrary containers without a view
- struct sway_view *view =
- config->handler_context.current_container->sway_view;
-
- if (view) {
- view_close(view);
+ break;
+ case C_CONTAINER:
+ con = container_destroy(con);
+ con = container_reap_empty(con);
+ arrange_windows(con, -1, -1);
+ break;
+ case C_VIEW:
+ view_close(con->sway_view);
+ break;
+ default:
+ break;
}
return cmd_results_new(CMD_SUCCESS, NULL, NULL);