diff options
author | Connor E <[email protected]> | 2018-11-10 12:55:06 +0000 |
---|---|---|
committer | Connor E <[email protected]> | 2018-11-10 12:55:06 +0000 |
commit | b865dabebab717fea75f91e8ccebabc99e36bdd9 (patch) | |
tree | df51bf83b899933f1347508b9f1bd55aefa21ae5 /sway/commands/bar/wrap_scroll.c | |
parent | 7fa7f4f48d17e0470c800b258061d188ceb705da (diff) |
Use parse_boolean where possible.
Diffstat (limited to 'sway/commands/bar/wrap_scroll.c')
-rw-r--r-- | sway/commands/bar/wrap_scroll.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sway/commands/bar/wrap_scroll.c b/sway/commands/bar/wrap_scroll.c index 701de00a..04a4e6b8 100644 --- a/sway/commands/bar/wrap_scroll.c +++ b/sway/commands/bar/wrap_scroll.c @@ -2,6 +2,7 @@ #include <strings.h> #include "sway/commands.h" #include "log.h" +#include "util.h" struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) { struct cmd_results *error = NULL; @@ -11,17 +12,14 @@ struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) { if (!config->current_bar) { return cmd_results_new(CMD_FAILURE, "wrap_scroll", "No bar defined."); } - if (strcasecmp("yes", argv[0]) == 0) { - config->current_bar->wrap_scroll = true; + config->current_bar->wrap_scroll = + parse_boolean(argv[0], config->current_bar->wrap_scroll); + if (config->current_bar->wrap_scroll) { wlr_log(WLR_DEBUG, "Enabling wrap scroll on bar: %s", - config->current_bar->id); - } else if (strcasecmp("no", argv[0]) == 0) { - config->current_bar->wrap_scroll = false; + config->current_bar->id); + } else { wlr_log(WLR_DEBUG, "Disabling wrap scroll on bar: %s", config->current_bar->id); - } else { - return cmd_results_new(CMD_INVALID, - "wrap_scroll", "Invalid value %s", argv[0]); } return cmd_results_new(CMD_SUCCESS, NULL, NULL); } |