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"
|
2018-03-30 14:41:33 +11:00
|
|
|
#include "sway/tree/view.h"
|
2018-03-31 15:44:17 +11:00
|
|
|
#include "sway/tree/container.h"
|
2018-01-21 06:10:11 +11:00
|
|
|
#include "sway/commands.h"
|
|
|
|
|
|
|
|
struct cmd_results *cmd_kill(int argc, char **argv) {
|
2018-03-31 15:44:17 +11:00
|
|
|
struct sway_container *con =
|
|
|
|
config->handler_context.current_container;
|
|
|
|
|
|
|
|
switch (con->type) {
|
|
|
|
case C_ROOT:
|
|
|
|
case C_OUTPUT:
|
|
|
|
case C_WORKSPACE:
|
2018-04-01 11:05:58 +10:00
|
|
|
case C_TYPES:
|
2018-01-22 00:46:31 +11:00
|
|
|
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-03-31 15:44:17 +11:00
|
|
|
break;
|
|
|
|
case C_CONTAINER:
|
|
|
|
con = container_destroy(con);
|
|
|
|
arrange_windows(con, -1, -1);
|
|
|
|
break;
|
|
|
|
case C_VIEW:
|
|
|
|
view_close(con->sway_view);
|
|
|
|
break;
|
2018-01-21 06:10:11 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
|
|
|
}
|