From 143714f1c9c2821ca70ef26949395557b15e2171 Mon Sep 17 00:00:00 2001 From: redtide Date: Wed, 13 Sep 2023 01:06:29 +0200 Subject: [PATCH] src/common/parse-bool.c: support on/off boolean values --- docs/labwc-config.5.scd | 6 ++++++ src/common/parse-bool.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index a68ab7e0..023f0578 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -94,6 +94,12 @@ Elements at the same level can have the same name whereas attributes cannot. Therefore, where multiple objects of the same kind are required (for example ** and **) the top-node of the object has to be an element. +## BOOLEANS + +Note that in this manual, Boolean values are listed as [yes|no] for simplicity, +but it's also possible to use [true|false] and\/or [on|off]; +this is for compatibility with Openbox. + ## CORE ``` diff --git a/src/common/parse-bool.c b/src/common/parse-bool.c index 0c10e9de..fe5f4f84 100644 --- a/src/common/parse-bool.c +++ b/src/common/parse-bool.c @@ -13,10 +13,14 @@ parse_bool(const char *str, int default_value) return true; } else if (!strcasecmp(str, "true")) { return true; + } else if (!strcasecmp(str, "on")) { + return true; } else if (!strcasecmp(str, "no")) { return false; } else if (!strcasecmp(str, "false")) { return false; + } else if (!strcasecmp(str, "off")) { + return false; } error_not_a_boolean: wlr_log(WLR_ERROR, "(%s) is not a boolean value", str); -- 2.52.0