aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-03-05 13:12:01 +0000
committervaxerski <[email protected]>2023-03-05 13:12:01 +0000
commitd5093f7af0f2d1e6d39a3facd0806c36e9667af1 (patch)
tree1e142ca7004775adce40b3c4388c8571e4d803b1
parent4abc608bc025002e0627a9840c2fc0a4e3c59cab (diff)
downloadHyprland-d5093f7af0f2d1e6d39a3facd0806c36e9667af1.tar.gz
Hyprland-d5093f7af0f2d1e6d39a3facd0806c36e9667af1.zip
add env keyword to cfg
-rw-r--r--src/config/ConfigManager.cpp16
-rw-r--r--src/config/ConfigManager.hpp1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 94e09c70..78543609 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -1039,6 +1039,20 @@ void CConfigManager::handleBindWS(const std::string& command, const std::string&
boundWorkspaces.push_back({ARGS[0], ARGS[1]});
}
+void CConfigManager::handleEnv(const std::string& command, const std::string& value) {
+ if (!isFirstLaunch)
+ return;
+
+ const auto ARGS = CVarList(value, 2);
+
+ if (ARGS[0].empty()) {
+ parseError = "env empty";
+ return;
+ }
+
+ setenv(ARGS[0].c_str(), ARGS[1].c_str(), 1);
+}
+
std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::string& VALUE, bool dynamic) {
if (dynamic) {
parseError = "";
@@ -1083,6 +1097,8 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
handleBlurLS(COMMAND, VALUE);
else if (COMMAND == "wsbind")
handleBindWS(COMMAND, VALUE);
+ else if (COMMAND == "env")
+ handleEnv(COMMAND, VALUE);
else {
configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
needsLayoutRecalc = 2;
diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp
index 742f9fe8..cfb81d56 100644
--- a/src/config/ConfigManager.hpp
+++ b/src/config/ConfigManager.hpp
@@ -244,6 +244,7 @@ class CConfigManager {
void handleSubmap(const std::string&, const std::string&);
void handleBlurLS(const std::string&, const std::string&);
void handleBindWS(const std::string&, const std::string&);
+ void handleEnv(const std::string&, const std::string&);
};
inline std::unique_ptr<CConfigManager> g_pConfigManager;