diff options
author | Ryan Dwyer <RyanDwyer@users.noreply.github.com> | 2018-07-24 19:23:04 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-24 19:23:04 +1000 |
commit | e02a6718c2c7313309b45e499034d614ee6207fc (patch) | |
tree | 429de47906f0ba1f114689c48cbabc5be8bb6e71 /common/util.c | |
parent | 94dd8823a0081f7983dce368d5d093d1d3eeaefe (diff) | |
parent | 6ccf2a2c66c1264450a4b3ab3dd344e1b3b44ca3 (diff) |
Merge branch 'master' into mouse-bindings
Diffstat (limited to 'common/util.c')
-rw-r--r-- | common/util.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/common/util.c b/common/util.c index e8a88772..467aa4b5 100644 --- a/common/util.c +++ b/common/util.c @@ -123,6 +123,22 @@ uint32_t parse_color(const char *color) { return res; } +bool parse_boolean(const char *boolean, bool current) { + if (strcasecmp(boolean, "1") == 0 + || strcasecmp(boolean, "yes") == 0 + || strcasecmp(boolean, "on") == 0 + || strcasecmp(boolean, "true") == 0 + || strcasecmp(boolean, "enable") == 0 + || strcasecmp(boolean, "enabled") == 0 + || strcasecmp(boolean, "active") == 0) { + return true; + } else if (strcasecmp(boolean, "toggle") == 0) { + return !current; + } + // All other values are false to match i3 + return false; +} + char* resolve_path(const char* path) { struct stat sb; ssize_t r; |