aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-01-20 14:10:11 -0500
committerTony Crisci <tony@dubstepdish.com>2018-01-20 14:10:11 -0500
commitc353e01c85049cfbc09510657e453b6aa5fd9c2d (patch)
treec6ef14cfc08861ff8c62675ca1fbbbb00e9197cf /sway/commands
parentcc3c713889e529c74888d9cd89af7039bfbae20c (diff)
add kill command
Diffstat (limited to 'sway/commands')
-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 @@
+#include "sway/input/input-manager.h"
+#include "sway/input/seat.h"
+#include "sway/view.h"
+#include "sway/commands.h"
+
+struct cmd_results *cmd_kill(int argc, char **argv) {
+ struct sway_seat *seat = config->handler_context.seat;
+ if (!seat) {
+ seat = sway_input_manager_get_default_seat(input_manager);
+ }
+
+ // TODO context for arbitrary sway containers (when we get criteria
+ // working) will make seat context not explicitly required
+ if (!seat) {
+ return cmd_results_new(CMD_FAILURE, NULL, "no seat context given");
+ }
+
+ struct sway_view *view = seat->focus->sway_view;
+
+ if (view->iface.close) {
+ view->iface.close(view);
+ }
+
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+}