diff options
Diffstat (limited to 'sway/commands/kill.c')
-rw-r--r-- | sway/commands/kill.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sway/commands/kill.c b/sway/commands/kill.c new file mode 100644 index 00000000..4bbf94e5 --- /dev/null +++ b/sway/commands/kill.c | |||
@@ -0,0 +1,25 @@ | |||
1 | #include "sway/input/input-manager.h" | ||
2 | #include "sway/input/seat.h" | ||
3 | #include "sway/view.h" | ||
4 | #include "sway/commands.h" | ||
5 | |||
6 | struct cmd_results *cmd_kill(int argc, char **argv) { | ||
7 | struct sway_seat *seat = config->handler_context.seat; | ||
8 | if (!seat) { | ||
9 | seat = sway_input_manager_get_default_seat(input_manager); | ||
10 | } | ||
11 | |||
12 | // TODO context for arbitrary sway containers (when we get criteria | ||
13 | // working) will make seat context not explicitly required | ||
14 | if (!seat) { | ||
15 | return cmd_results_new(CMD_FAILURE, NULL, "no seat context given"); | ||
16 | } | ||
17 | |||
18 | struct sway_view *view = seat->focus->sway_view; | ||
19 | |||
20 | if (view->iface.close) { | ||
21 | view->iface.close(view); | ||
22 | } | ||
23 | |||
24 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
25 | } | ||