diff options
Diffstat (limited to 'sway/commands/kill.c')
-rw-r--r-- | sway/commands/kill.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sway/commands/kill.c b/sway/commands/kill.c new file mode 100644 index 00000000..3804f0b0 --- /dev/null +++ b/sway/commands/kill.c | |||
@@ -0,0 +1,28 @@ | |||
1 | #include <wlr/util/log.h> | ||
2 | #include "log.h" | ||
3 | #include "sway/input/input-manager.h" | ||
4 | #include "sway/input/seat.h" | ||
5 | #include "sway/view.h" | ||
6 | #include "sway/commands.h" | ||
7 | |||
8 | struct cmd_results *cmd_kill(int argc, char **argv) { | ||
9 | if (config->reading) { | ||
10 | return cmd_results_new(CMD_FAILURE, "kill", | ||
11 | "Command 'kill' cannot be used in the config file"); | ||
12 | } | ||
13 | if (!sway_assert(config->handler_context.current_container, | ||
14 | "cmd_kill called without container context")) { | ||
15 | return cmd_results_new(CMD_INVALID, NULL, | ||
16 | "cmd_kill called without container context " | ||
17 | "(this is a bug in sway)"); | ||
18 | } | ||
19 | // TODO close arbitrary containers without a view | ||
20 | struct sway_view *view = | ||
21 | config->handler_context.current_container->sway_view; | ||
22 | |||
23 | if (view) { | ||
24 | view_close(view); | ||
25 | } | ||
26 | |||
27 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
28 | } | ||