diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-07-23 21:49:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-23 21:49:16 -0400 |
commit | 71774ecd3658653328f3c903869b52c51c62e237 (patch) | |
tree | bfc136252f81a5350f240c20161d2d0bfc2f80dd /sway/commands/urgent.c | |
parent | 224ade138208e9aa525423cbfbd643aa9d9b63c3 (diff) | |
parent | 9ec1d6cf79e6f9c3233f577c6fddeaeb21bb1bfc (diff) |
Merge pull request #2340 from RedSoxFan/parse_boolean
Switch to using a function to parse booleans
Diffstat (limited to 'sway/commands/urgent.c')
-rw-r--r-- | sway/commands/urgent.c | 10 |
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); |