mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-06 07:01:57 -07:00
Fix exec-once being wack on launch
This commit is contained in:
@@ -263,7 +263,7 @@ void CConfigManager::parseLine(std::string& line) {
|
||||
return;
|
||||
} else if (COMMAND == "exec-once") {
|
||||
if (isFirstLaunch) {
|
||||
handleRawExec(COMMAND, VALUE);
|
||||
firstExecRequests.push_back(VALUE);
|
||||
}
|
||||
return;
|
||||
} else if (COMMAND == "monitor") {
|
||||
@@ -479,3 +479,16 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) {
|
||||
|
||||
return returns;
|
||||
}
|
||||
|
||||
void CConfigManager::dispatchExecOnce() {
|
||||
if (firstExecDispatched || isFirstLaunch)
|
||||
return;
|
||||
|
||||
firstExecDispatched = true;
|
||||
|
||||
for (auto& c : firstExecRequests) {
|
||||
handleRawExec("", c);
|
||||
}
|
||||
|
||||
firstExecRequests.clear(); // free some kb of memory :P
|
||||
}
|
@@ -51,6 +51,9 @@ public:
|
||||
|
||||
std::vector<SWindowRule> getMatchingRules(CWindow*);
|
||||
|
||||
// no-op when done.
|
||||
void dispatchExecOnce();
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, SConfigValue> configValues;
|
||||
time_t lastModifyTime = 0; // for reloading the config if changed
|
||||
@@ -64,6 +67,9 @@ private:
|
||||
std::deque<SMonitorRule> m_dMonitorRules;
|
||||
std::deque<SWindowRule> m_dWindowRules;
|
||||
|
||||
bool firstExecDispatched = false;
|
||||
std::deque<std::string> firstExecRequests;
|
||||
|
||||
// internal methods
|
||||
void loadConfigLoadVars();
|
||||
SConfigValue getConfigValueSafe(std::string);
|
||||
|
@@ -118,6 +118,8 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
||||
g_pCompositor->sanityCheckWorkspaces();
|
||||
g_pAnimationManager->tick();
|
||||
g_pCompositor->cleanupWindows();
|
||||
|
||||
g_pConfigManager->dispatchExecOnce(); // We exec-once when at least one monitor starts refreshing, meaning stuff has init'd
|
||||
}
|
||||
|
||||
timespec now;
|
||||
|
Reference in New Issue
Block a user