aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/kill.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/kill.c')
-rw-r--r--sway/commands/kill.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sway/commands/kill.c b/sway/commands/kill.c
index f3fa52f1..85ca0f33 100644
--- a/sway/commands/kill.c
+++ b/sway/commands/kill.c
@@ -2,15 +2,27 @@
#include "log.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
-#include "sway/tree/view.h"
#include "sway/tree/container.h"
+#include "sway/tree/view.h"
+#include "sway/tree/workspace.h"
#include "sway/commands.h"
+static void close_container_iterator(struct sway_container *con, void *data) {
+ if (con->view) {
+ view_close(con->view);
+ }
+}
+
struct cmd_results *cmd_kill(int argc, char **argv) {
- struct sway_container *con =
- config->handler_context.current_container;
+ struct sway_container *con = config->handler_context.container;
+ struct sway_workspace *ws = config->handler_context.workspace;
- container_close(con);
+ if (con) {
+ close_container_iterator(con, NULL);
+ container_for_each_child(con, close_container_iterator, NULL);
+ } else {
+ workspace_for_each_container(ws, close_container_iterator, NULL);
+ }
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}