]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/main.c: add environment variable LABWC_VER
author01micko <01micko#gmail.com>
Mon, 21 Oct 2024 01:07:01 +0000 (11:07 +1000)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 28 Oct 2024 21:40:01 +0000 (21:40 +0000)
src/config/session.c add env var LABWC_VER
This could be useful going forward for helper programs
such as `labwc-menu-generator` or `labwc-tweaks`

src/config/session.c
src/main.c

index 3238369f69776b8f05a59c96a3c8b83a5c8bd43d..c488c6b4540aab9f778df826c6d842763e6ec270 100644 (file)
@@ -29,6 +29,7 @@ static const char *const env_vars[] = {
        "XCURSOR_THEME",
        "XDG_SESSION_TYPE",
        "LABWC_PID",
+       "LABWC_VER",
        NULL
 };
 
index 6d3200cdcc1b9efbb0892d5c7037c5430b313f24..147a9e4af0b51b78bc10478058a49128121e9b26 100644 (file)
@@ -191,6 +191,13 @@ main(int argc, char *argv[])
                wlr_log(WLR_DEBUG, "LABWC_PID=%s", pid);
        }
 
+       /* useful for helper programs */
+       if (setenv("LABWC_VER", LABWC_VERSION, true) < 0) {
+               wlr_log_errno(WLR_ERROR, "unable to set LABWC_VER");
+       } else {
+               wlr_log(WLR_DEBUG, "LABWC_VER=%s", LABWC_VERSION);
+       }
+
        if (!getenv("XDG_RUNTIME_DIR")) {
                wlr_log(WLR_ERROR, "XDG_RUNTIME_DIR is unset");
                exit(EXIT_FAILURE);