From 56a30712b5c2ccf247e555cf58a35a110fa173d9 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 9 Feb 2024 19:42:19 +0000 Subject: [PATCH] oops missed exec-once --- src/config/ConfigManager.cpp | 22 +++++++++++++++++++++- src/config/ConfigManager.hpp | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index ba110123..1543b194 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -88,6 +88,18 @@ static Hyprlang::CParseResult handleRawExec(const char* c, const char* v) { return result; } +static Hyprlang::CParseResult handleExecOnce(const char* c, const char* v) { + const std::string VALUE = v; + const std::string COMMAND = c; + + const auto RESULT = g_pConfigManager->handleExecOnce(COMMAND, VALUE); + + Hyprlang::CParseResult result; + if (RESULT.has_value()) + result.setError(RESULT.value().c_str()); + return result; +} + static Hyprlang::CParseResult handleMonitor(const char* c, const char* v) { const std::string VALUE = v; const std::string COMMAND = c; @@ -511,6 +523,7 @@ CConfigManager::CConfigManager() { // keywords m_pConfig->registerHandler(&::handleRawExec, "exec", {false}); + m_pConfig->registerHandler(&::handleExecOnce, "exec-once", {false}); m_pConfig->registerHandler(&::handleMonitor, "monitor", {false}); m_pConfig->registerHandler(&::handleBind, "bind", {true}); m_pConfig->registerHandler(&::handleUnbind, "unbind", {false}); @@ -1386,7 +1399,6 @@ std::string CConfigManager::getDefaultWorkspaceFor(const std::string& name) { } std::optional CConfigManager::handleRawExec(const std::string& command, const std::string& args) { - // Exec in the background dont wait for it. if (isFirstLaunch) { firstExecRequests.push_back(args); return {}; @@ -1396,6 +1408,14 @@ std::optional CConfigManager::handleRawExec(const std::string& comm return {}; } +std::optional CConfigManager::handleExecOnce(const std::string& command, const std::string& args) { + if (isFirstLaunch) { + firstExecRequests.push_back(args); + return {}; + } + return {}; +} + static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) { auto args = CVarList(modeline, 0, 's'); diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index f90754cc..85983f16 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -143,6 +143,7 @@ class CConfigManager { // keywords std::optional handleRawExec(const std::string&, const std::string&); + std::optional handleExecOnce(const std::string&, const std::string&); std::optional handleMonitor(const std::string&, const std::string&); std::optional handleBind(const std::string&, const std::string&); std::optional handleUnbind(const std::string&, const std::string&);