diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-12-18 17:23:24 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-18 17:23:24 +0000 |
| commit | 6175ecd4c4ba817c4620f66a75e1e11da7c7a8ca (patch) | |
| tree | cf73852f1fc08b1dcee5a3a7380f914aaad9c50a /src/helpers/env | |
| parent | f88deb928a0f7dc02f427473f8c29e8f2bed14a3 (diff) | |
debug: move to hyprutils' logger (#12673)
Diffstat (limited to 'src/helpers/env')
| -rw-r--r-- | src/helpers/env/Env.cpp | 19 | ||||
| -rw-r--r-- | src/helpers/env/Env.hpp | 8 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/helpers/env/Env.cpp b/src/helpers/env/Env.cpp new file mode 100644 index 00000000..606d5f72 --- /dev/null +++ b/src/helpers/env/Env.cpp @@ -0,0 +1,19 @@ +#include "Env.hpp" + +#include <cstdlib> +#include <string_view> + +bool Env::envEnabled(const std::string& env) { + auto ret = getenv(env.c_str()); + if (!ret) + return false; + + const std::string_view sv = ret; + + return !sv.empty() && sv != "0"; +} + +bool Env::isTrace() { + static bool TRACE = envEnabled("HYPRLAND_TRACE"); + return TRACE; +} diff --git a/src/helpers/env/Env.hpp b/src/helpers/env/Env.hpp new file mode 100644 index 00000000..030fe736 --- /dev/null +++ b/src/helpers/env/Env.hpp @@ -0,0 +1,8 @@ +#pragma once + +#include <string> + +namespace Env { + bool envEnabled(const std::string& env); + bool isTrace(); +} |
