From 4b55ec6830602c36fddcfbe40188a7fdc58a975e Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Mon, 13 Oct 2025 14:16:48 +0200 Subject: [PATCH] windowrules: add modal prop (#12024) adds a modal prop for targeting modal windows with rules --- src/config/ConfigManager.cpp | 9 +++++++++ src/desktop/WindowRule.hpp | 1 + 2 files changed, 10 insertions(+) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 7a58ffcf..7b24263a 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1562,6 +1562,11 @@ std::vector> CConfigManager::getMatchingRules(PHLWINDOW pWindow, continue; } + if (rule->m_modal != -1) { + if (rule->m_modal != pWindow->isModal()) + continue; + } + if (!rule->m_fullscreenState.empty()) { const auto ARGS = CVarList(rule->m_fullscreenState, 2, ' '); // @@ -2735,6 +2740,8 @@ std::optional CConfigManager::handleWindowRule(const std::string& c set |= (rule->m_focus = (v == "1"), true); if (auto v = get("group"); !v.empty()) 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()) set |= (rule->m_fullscreenState = v, true); @@ -2797,6 +2804,8 @@ std::optional CConfigManager::handleWindowRule(const std::string& c return false; if (rule->m_group != -1 && rule->m_group != other->m_group) return false; + if (rule->m_modal != -1 && rule->m_modal != other->m_modal) + return false; return true; }); } else { diff --git a/src/desktop/WindowRule.hpp b/src/desktop/WindowRule.hpp index 2efeba0f..5bf462e9 100644 --- a/src/desktop/WindowRule.hpp +++ b/src/desktop/WindowRule.hpp @@ -60,6 +60,7 @@ class CWindowRule { int m_pinned = -1; int m_focus = -1; int m_group = -1; + int m_modal = -1; std::string m_fullscreenState = ""; // empty means any std::string m_onWorkspace = ""; // empty means any std::string m_workspace = ""; // empty means any