oops missed exec-once

This commit is contained in:
Vaxry 2024-02-09 19:42:19 +00:00
parent 8c5c65dbfb
commit 56a30712b5
2 changed files with 22 additions and 1 deletions

View file

@ -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<std::string> 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<std::string> CConfigManager::handleRawExec(const std::string& comm
return {};
}
std::optional<std::string> 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');

View file

@ -143,6 +143,7 @@ class CConfigManager {
// keywords
std::optional<std::string> handleRawExec(const std::string&, const std::string&);
std::optional<std::string> handleExecOnce(const std::string&, const std::string&);
std::optional<std::string> handleMonitor(const std::string&, const std::string&);
std::optional<std::string> handleBind(const std::string&, const std::string&);
std::optional<std::string> handleUnbind(const std::string&, const std::string&);