windowrules: add modal prop (#12024)

adds a modal prop for targeting modal windows with rules
This commit is contained in:
Vaxry 2025-10-13 14:16:48 +02:00 committed by GitHub
parent 7fcaf332e8
commit 4b55ec6830
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -1562,6 +1562,11 @@ std::vector<SP<CWindowRule>> CConfigManager::getMatchingRules(PHLWINDOW pWindow,
continue; continue;
} }
if (rule->m_modal != -1) {
if (rule->m_modal != pWindow->isModal())
continue;
}
if (!rule->m_fullscreenState.empty()) { if (!rule->m_fullscreenState.empty()) {
const auto ARGS = CVarList(rule->m_fullscreenState, 2, ' '); const auto ARGS = CVarList(rule->m_fullscreenState, 2, ' ');
// //
@ -2735,6 +2740,8 @@ std::optional<std::string> CConfigManager::handleWindowRule(const std::string& c
set |= (rule->m_focus = (v == "1"), true); set |= (rule->m_focus = (v == "1"), true);
if (auto v = get("group"); !v.empty()) if (auto v = get("group"); !v.empty())
set |= (rule->m_group = (v == "1"), true); set |= (rule->m_group = (v == "1"), true);
if (auto v = get("modal"); !v.empty())
set |= (rule->m_modal = (v == "1"), true);
if (auto v = get("fullscreenstate"); !v.empty()) if (auto v = get("fullscreenstate"); !v.empty())
set |= (rule->m_fullscreenState = v, true); set |= (rule->m_fullscreenState = v, true);
@ -2797,6 +2804,8 @@ std::optional<std::string> CConfigManager::handleWindowRule(const std::string& c
return false; return false;
if (rule->m_group != -1 && rule->m_group != other->m_group) if (rule->m_group != -1 && rule->m_group != other->m_group)
return false; return false;
if (rule->m_modal != -1 && rule->m_modal != other->m_modal)
return false;
return true; return true;
}); });
} else { } else {

View file

@ -60,6 +60,7 @@ class CWindowRule {
int m_pinned = -1; int m_pinned = -1;
int m_focus = -1; int m_focus = -1;
int m_group = -1; int m_group = -1;
int m_modal = -1;
std::string m_fullscreenState = ""; // empty means any std::string m_fullscreenState = ""; // empty means any
std::string m_onWorkspace = ""; // empty means any std::string m_onWorkspace = ""; // empty means any
std::string m_workspace = ""; // empty means any std::string m_workspace = ""; // empty means any