summaryrefslogtreecommitdiff
path: root/src/helpers/env/Env.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers/env/Env.cpp')
-rw-r--r--src/helpers/env/Env.cpp19
1 files changed, 19 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;
+}