aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/kill.c
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-01-20 14:10:11 -0500
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-01-20 14:10:11 -0500
commitc353e01c85049cfbc09510657e453b6aa5fd9c2d (patch)
treec6ef14cfc08861ff8c62675ca1fbbbb00e9197cf /sway/commands/kill.c
parentseat config handler context (diff)
downloadsway-c353e01c85049cfbc09510657e453b6aa5fd9c2d.tar.gz
sway-c353e01c85049cfbc09510657e453b6aa5fd9c2d.tar.zst
sway-c353e01c85049cfbc09510657e453b6aa5fd9c2d.zip
add kill command
Diffstat (limited to 'sway/commands/kill.c')
-rw-r--r--sway/commands/kill.c25
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
6struct 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}