2018-01-22 00:46:31 +11:00
|
|
|
#include <wlr/util/log.h>
|
2018-01-22 06:15:10 +11:00
|
|
|
#include "log.h"
|
2018-01-21 06:10:11 +11:00
|
|
|
#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) {
|
2018-01-22 11:13:11 +11:00
|
|
|
if (config->reading) {
|
|
|
|
return cmd_results_new(CMD_FAILURE, "kill",
|
|
|
|
"Command 'kill' cannot be used in the config file");
|
|
|
|
}
|
2018-01-22 06:15:10 +11:00
|
|
|
if (!sway_assert(config->handler_context.current_container,
|
|
|
|
"cmd_kill called without container context")) {
|
2018-01-22 00:46:31 +11:00
|
|
|
return cmd_results_new(CMD_INVALID, NULL,
|
|
|
|
"cmd_kill called without container context "
|
|
|
|
"(this is a bug in sway)");
|
2018-01-21 06:10:11 +11:00
|
|
|
}
|
2018-01-22 00:46:31 +11:00
|
|
|
// TODO close arbitrary containers without a view
|
|
|
|
struct sway_view *view =
|
|
|
|
config->handler_context.current_container->sway_view;
|
2018-01-21 06:10:11 +11:00
|
|
|
|
2018-01-22 01:09:53 +11:00
|
|
|
if (view) {
|
|
|
|
view_close(view);
|
2018-01-21 06:10:11 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
|
|
|
}
|