diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-09-07 11:24:40 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-09-07 11:25:44 +0200 |
| commit | 44a2d755c68f8e6990ea885a45ea370be8b3a392 (patch) | |
| tree | 8da89ec337c8f0b930f3ab8b414c8c2d791ba38a /src/config/ConfigManager.cpp | |
| parent | cf5426f2d8ddce5de9dc1859857d56700560b976 (diff) | |
Added Xwayland and floating props to windowrulev2
Diffstat (limited to 'src/config/ConfigManager.cpp')
| -rw-r--r-- | src/config/ConfigManager.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 5e03e275..1f6b3829 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -777,11 +777,14 @@ void CConfigManager::handleWindowRuleV2(const std::string& command, const std::s SWindowRule rule; rule.v2 = true; rule.szRule = RULE; + rule.szValue = VALUE; const auto TITLEPOS = VALUE.find("title:"); const auto CLASSPOS = VALUE.find("class:"); + const auto X11POS = VALUE.find("xwayland:"); + const auto FLOATPOS = VALUE.find("floating:"); - if (TITLEPOS == std::string::npos && CLASSPOS == std::string::npos) { + if (TITLEPOS == std::string::npos && CLASSPOS == std::string::npos && X11POS == std::string::npos && FLOATPOS == std::string::npos) { Debug::log(ERR, "Invalid rulev2 syntax: %s", VALUE.c_str()); parseError = "Invalid rulev2 syntax: " + VALUE; return; @@ -794,6 +797,8 @@ void CConfigManager::handleWindowRuleV2(const std::string& command, const std::s size_t min = 999999; if (TITLEPOS > pos && TITLEPOS < min) min = TITLEPOS; if (CLASSPOS > pos && CLASSPOS < min) min = CLASSPOS; + if (X11POS > pos && X11POS < min) min = X11POS; + if (FLOATPOS > pos && FLOATPOS < min) min = FLOATPOS; result = result.substr(0, min - pos); @@ -811,6 +816,14 @@ void CConfigManager::handleWindowRuleV2(const std::string& command, const std::s rule.szTitle = extract(TITLEPOS + 6); } + if (X11POS != std::string::npos) { + rule.bX11 = extract(X11POS + 9) == "1" ? 1 : 0; + } + + if (FLOATPOS != std::string::npos) { + rule.bFloating = extract(FLOATPOS + 9) == "1" ? 1 : 0; + } + m_dWindowRules.push_back(rule); } @@ -1370,6 +1383,16 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) { if (!std::regex_search(title, RULECHECK)) continue; } + + if (rule.bX11 != -1) { + if (pWindow->m_bIsX11 != rule.bX11) + continue; + } + + if (rule.bFloating != -1) { + if (pWindow->m_bIsFloating != rule.bFloating) + continue; + } } catch (...) { Debug::log(ERR, "Regex error at %s", rule.szValue.c_str()); continue; |
