diff options
author | vaxerski <[email protected]> | 2022-06-24 16:25:57 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-06-24 16:25:57 +0200 |
commit | e7467c60f9fe9e66c74dd8dc7c752a73ed4bc4db (patch) | |
tree | f4b259f0033f0c3c5eae427a4264f35dd5a2e014 | |
parent | 3e8842e1f8d50263d56b0df3ae37708b4be428d6 (diff) | |
download | Hyprland-e7467c60f9fe9e66c74dd8dc7c752a73ed4bc4db.tar.gz Hyprland-e7467c60f9fe9e66c74dd8dc7c752a73ed4bc4db.zip |
fix windowrule regex logic and add title:
-rw-r--r-- | src/config/ConfigManager.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index d742070a..c3621847 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -911,15 +911,26 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) { std::string title = g_pXWaylandManager->getTitle(pWindow); std::string appidclass = g_pXWaylandManager->getAppIDClass(pWindow); + Debug::log(LOG, "Searching for matching rules for %s (title: %s)", appidclass.c_str(), title.c_str()); + for (auto& rule : m_dWindowRules) { // check if we have a matching rule try { - std::regex classCheck(rule.szValue); + if (rule.szValue.find("title:") == 0) { + // we have a title rule. + std::regex RULECHECK(rule.szValue.substr(6)); + + if (!std::regex_search(title, RULECHECK)) + continue; + } else { + std::regex classCheck(rule.szValue); - if (!std::regex_search(title, classCheck) && !std::regex_search(appidclass, classCheck)) - continue; + if (!std::regex_search(appidclass, classCheck)) + continue; + } } catch (...) { Debug::log(ERR, "Regex error at %s", rule.szValue.c_str()); + continue; } // applies. Read the rule and behave accordingly |