diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-11-10 08:06:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-10 08:06:11 -0500 |
commit | 80a1c340a9c8c8aac5fe4dd7bc1dc15b43fce0dc (patch) | |
tree | df51bf83b899933f1347508b9f1bd55aefa21ae5 /sway/commands/bar/workspace_buttons.c | |
parent | 7fa7f4f48d17e0470c800b258061d188ceb705da (diff) | |
parent | b865dabebab717fea75f91e8ccebabc99e36bdd9 (diff) |
Merge pull request #3098 from c-edw/feature/RefactorArgParse
Use parse_boolean where possible.
Diffstat (limited to 'sway/commands/bar/workspace_buttons.c')
-rw-r--r-- | sway/commands/bar/workspace_buttons.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sway/commands/bar/workspace_buttons.c b/sway/commands/bar/workspace_buttons.c index a4079b2a..cd001e20 100644 --- a/sway/commands/bar/workspace_buttons.c +++ b/sway/commands/bar/workspace_buttons.c @@ -2,6 +2,7 @@ #include <strings.h> #include "sway/commands.h" #include "log.h" +#include "util.h" struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) { struct cmd_results *error = NULL; @@ -12,17 +13,14 @@ struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) { return cmd_results_new(CMD_FAILURE, "workspace_buttons", "No bar defined."); } - if (strcasecmp("yes", argv[0]) == 0) { - config->current_bar->workspace_buttons = true; + config->current_bar->workspace_buttons = + parse_boolean(argv[0], config->current_bar->workspace_buttons); + if (config->current_bar->workspace_buttons) { wlr_log(WLR_DEBUG, "Enabling workspace buttons on bar: %s", config->current_bar->id); - } else if (strcasecmp("no", argv[0]) == 0) { - config->current_bar->workspace_buttons = false; + } else { wlr_log(WLR_DEBUG, "Disabling workspace buttons on bar: %s", config->current_bar->id); - } else { - return cmd_results_new(CMD_INVALID, "workspace_buttons", - "Invalid value %s", argv[0]); } return cmd_results_new(CMD_SUCCESS, NULL, NULL); } |