swayfx/sway/commands/kill.c

25 lines
680 B
C
Raw Normal View History

#include <wlr/util/log.h>
#include "log.h"
2018-01-21 06:10:11 +11:00
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
#include "sway/tree/view.h"
2018-01-21 06:10:11 +11:00
#include "sway/commands.h"
struct cmd_results *cmd_kill(int argc, char **argv) {
enum sway_container_type type = config->handler_context.current_container->type;
2018-02-05 05:39:10 +11:00
if (type != C_VIEW && type != C_CONTAINER) {
return cmd_results_new(CMD_INVALID, NULL,
2018-01-31 15:09:21 +11:00
"Can only kill views and containers with this command");
2018-01-21 06:10:11 +11:00
}
2018-02-05 05:39:10 +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);
}