diff options
author | emersion <contact@emersion.fr> | 2018-08-02 23:49:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-02 23:49:25 +0100 |
commit | 3a54e2291c017397ceff60511c29fe70d229bc8b (patch) | |
tree | d340b7776f945462f5ecffc830ada4d5fbe82f51 /common | |
parent | c35a34262f8da368f65d37f811a2264647e0dae6 (diff) | |
parent | e07da5fc5c6ac5c186662b56b08ca71531119de0 (diff) |
Merge branch 'master' into wlr-gamma-control
Diffstat (limited to 'common')
-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; |