aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/urgent.c
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2018-07-23 15:04:46 -0400
committerBrian Ashworth <bosrsf04@gmail.com>2018-07-23 21:33:17 -0400
commit863914ec9574eb58cb0746d59f216997c4863cdf (patch)
treeaaddd8ae854d1dde4b50cfd4ef470c1acf83b6ce /sway/commands/urgent.c
parent224ade138208e9aa525423cbfbd643aa9d9b63c3 (diff)
Switch to using a function to parse booleans
Diffstat (limited to 'sway/commands/urgent.c')
-rw-r--r--sway/commands/urgent.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sway/commands/urgent.c b/sway/commands/urgent.c
index d199858a..51c497c4 100644
--- a/sway/commands/urgent.c
+++ b/sway/commands/urgent.c
@@ -5,6 +5,7 @@
#include "sway/tree/container.h"
#include "sway/tree/view.h"
#include "sway/tree/layout.h"
+#include "util.h"
struct cmd_results *cmd_urgent(int argc, char **argv) {
struct cmd_results *error = NULL;
@@ -19,17 +20,12 @@ struct cmd_results *cmd_urgent(int argc, char **argv) {
}
struct sway_view *view = container->sway_view;
- if (strcmp(argv[0], "enable") == 0) {
- view_set_urgent(view, true);
- } else if (strcmp(argv[0], "disable") == 0) {
- view_set_urgent(view, false);
- } else if (strcmp(argv[0], "allow") == 0) {
+ if (strcmp(argv[0], "allow") == 0) {
view->allow_request_urgent = true;
} else if (strcmp(argv[0], "deny") == 0) {
view->allow_request_urgent = false;
} else {
- return cmd_results_new(CMD_INVALID, "urgent",
- "Expected 'urgent <enable|disable|allow|deny>'");
+ view_set_urgent(view, parse_boolean(argv[0], view_is_urgent(view)));
}
return cmd_results_new(CMD_SUCCESS, NULL, NULL);