aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-08-02 23:49:25 +0100
committerGitHub <noreply@github.com>2018-08-02 23:49:25 +0100
commit3a54e2291c017397ceff60511c29fe70d229bc8b (patch)
treed340b7776f945462f5ecffc830ada4d5fbe82f51 /common
parentc35a34262f8da368f65d37f811a2264647e0dae6 (diff)
parente07da5fc5c6ac5c186662b56b08ca71531119de0 (diff)
Merge branch 'master' into wlr-gamma-control
Diffstat (limited to 'common')
-rw-r--r--common/util.c16
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;