2018-01-21 14:46:31 +01:00
|
|
|
#include <wlr/util/log.h>
|
2018-01-21 20:15:10 +01:00
|
|
|
#include "log.h"
|
2018-01-20 20:10:11 +01:00
|
|
|
#include "sway/input/input-manager.h"
|
|
|
|
#include "sway/input/seat.h"
|
2018-03-30 05:41:33 +02:00
|
|
|
#include "sway/tree/view.h"
|
2018-01-20 20:10:11 +01:00
|
|
|
#include "sway/commands.h"
|
|
|
|
|
|
|
|
struct cmd_results *cmd_kill(int argc, char **argv) {
|
2018-03-30 05:41:33 +02:00
|
|
|
enum sway_container_type type = config->handler_context.current_container->type;
|
2018-02-04 19:39:10 +01:00
|
|
|
if (type != C_VIEW && type != C_CONTAINER) {
|
2018-01-21 14:46:31 +01:00
|
|
|
return cmd_results_new(CMD_INVALID, NULL,
|
2018-01-31 05:09:21 +01:00
|
|
|
"Can only kill views and containers with this command");
|
2018-01-20 20:10:11 +01:00
|
|
|
}
|
2018-02-04 19:39:10 +01:00
|
|
|
|
2018-01-21 14:46:31 +01:00
|
|
|
// TODO close arbitrary containers without a view
|
|
|
|
struct sway_view *view =
|
|
|
|
config->handler_context.current_container->sway_view;
|
2018-01-20 20:10:11 +01:00
|
|
|
|
2018-01-21 15:09:53 +01:00
|
|
|
if (view) {
|
|
|
|
view_close(view);
|
2018-01-20 20:10:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
|
|
|
}
|