sway/sway/commands/urgent.c
M Stoeckl 2a684cad5f Remove now-unused "input" argument of cmd_results_new
Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))`
applied to `cmd_results_new`.

String usage constants have been converted from pointers to arrays when
encountered. General handler format strings were sometimes modified to
include the old input string, especially for unknown command errors.
2019-01-14 08:05:29 -05:00

33 lines
938 B
C

#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"
#include "util.h"
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.container;
if (!container) {
return cmd_results_new(CMD_FAILURE, "No current container");
}
if (!container->view) {
return cmd_results_new(CMD_INVALID, "Only views can be urgent");
}
struct sway_view *view = container->view;
if (strcmp(argv[0], "allow") == 0) {
view->allow_request_urgent = true;
} else if (strcmp(argv[0], "deny") == 0) {
view->allow_request_urgent = false;
} else {
view_set_urgent(view, parse_boolean(argv[0], view_is_urgent(view)));
}
return cmd_results_new(CMD_SUCCESS, NULL);
}