diff options
| author | vaxerski <vaxry@vaxry.net> | 2022-11-10 13:39:23 +0000 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2022-11-10 13:39:23 +0000 |
| commit | 851df11eb595c5863bb931c32cbaa446c7071813 (patch) | |
| tree | e64d48e7effeb910f66852b93fc8eb446f6f409c /src/managers/KeybindManager.cpp | |
| parent | 5f2c741f49245e90b46b2912f78cd2f3ba33d36a (diff) | |
Added exec rules
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 7eb556b5..a529da97 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -483,6 +483,17 @@ bool CKeybindManager::handleInternalKeybinds(xkb_keysym_t keysym) { // Dispatchers void CKeybindManager::spawn(std::string args) { + + args = removeBeginEndSpacesTabs(args); + + std::string RULES = ""; + + if (args[0] == '[') { + // we have exec rules + RULES = args.substr(1, args.substr(1).find_first_of(']')); + args = args.substr(args.find_first_of(']') + 1); + } + if (g_pXWaylandManager->m_sWLRXWayland) args = "WAYLAND_DISPLAY=" + std::string(g_pCompositor->m_szWLDisplaySocket) + " DISPLAY=" + std::string(g_pXWaylandManager->m_sWLRXWayland->display_name) + " " + args; else @@ -535,7 +546,18 @@ void CKeybindManager::spawn(std::string args) { Debug::log(LOG, "Fail to create the second fork"); return; } + Debug::log(LOG, "Process Created with pid %d", grandchild); + + if (!RULES.empty()) { + const auto RULESLIST = CVarList(RULES, 0, ';'); + + for (auto& r : RULESLIST) { + g_pConfigManager->addExecRule({r, (unsigned long)grandchild}); + } + + Debug::log(LOG, "Applied %i rule arguments for exec.", RULESLIST.size()); + } } void CKeybindManager::killActive(std::string args) { |
