2018-07-15 22:43:33 +10:00
|
|
|
#include "log.h"
|
|
|
|
#include "sway/commands.h"
|
|
|
|
#include "sway/config.h"
|
|
|
|
#include "sway/tree/arrange.h"
|
|
|
|
#include "sway/tree/container.h"
|
|
|
|
#include "sway/tree/view.h"
|
2018-07-24 05:04:46 +10:00
|
|
|
#include "util.h"
|
2018-07-15 22:43:33 +10:00
|
|
|
|
|
|
|
struct cmd_results *cmd_urgent(int argc, char **argv) {
|
|
|
|
struct cmd_results *error = NULL;
|
|
|
|
if ((error = checkarg(argc, "urgent", EXPECTED_EQUAL_TO, 1))) {
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
struct sway_container *container =
|
|
|
|
config->handler_context.current_container;
|
|
|
|
if (container->type != C_VIEW) {
|
|
|
|
return cmd_results_new(CMD_INVALID, "urgent",
|
|
|
|
"Only views can be urgent");
|
|
|
|
}
|
|
|
|
struct sway_view *view = container->sway_view;
|
|
|
|
|
2018-07-24 05:04:46 +10:00
|
|
|
if (strcmp(argv[0], "allow") == 0) {
|
2018-07-15 22:43:33 +10:00
|
|
|
view->allow_request_urgent = true;
|
|
|
|
} else if (strcmp(argv[0], "deny") == 0) {
|
|
|
|
view->allow_request_urgent = false;
|
|
|
|
} else {
|
2018-07-24 05:04:46 +10:00
|
|
|
view_set_urgent(view, parse_boolean(argv[0], view_is_urgent(view)));
|
2018-07-15 22:43:33 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
|
|
|
}
|