aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/kill.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-04-02 20:44:56 -0400
committerGitHub <noreply@github.com>2018-04-02 20:44:56 -0400
commitd3eaf6468cf45007e63386afb3d148919959babe (patch)
tree6c0d05d8605ff5bec4d87a2064e46e6e8cb25385 /sway/commands/kill.c
parent64b9b4b1556c1c45273bfbe0ae1c92245414cfed (diff)
parent32ef182f474dbb40c4bedb69256ca6ec8bd31039 (diff)
Merge pull request #1668 from acrisci/split-containers
Basic split containers
Diffstat (limited to 'sway/commands/kill.c')
-rw-r--r--sway/commands/kill.c27
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 @@
#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:
+ case C_TYPES:
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);
+ arrange_windows(con, -1, -1);
+ break;
+ case C_VIEW:
+ view_close(con->sway_view);
+ break;
}
return cmd_results_new(CMD_SUCCESS, NULL, NULL);