diff options
author | MightyPlaza <[email protected]> | 2024-05-10 11:27:54 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-10 12:27:54 +0100 |
commit | c19903eaf8f3908e864e57c8449325e9b5e0c9bd (patch) | |
tree | 7b3b4b688f5b30b998ca49d0dbe49dfd1c31a177 | |
parent | cc4ac52309a7715c09c1e19545bc0fa4048c4604 (diff) | |
download | Hyprland-c19903eaf8f3908e864e57c8449325e9b5e0c9bd.tar.gz Hyprland-c19903eaf8f3908e864e57c8449325e9b5e0c9bd.zip |
windowrules add focusonactivate (#5976)
modified: src/config/ConfigManager.cpp
modified: src/desktop/Window.cpp
modified: src/desktop/Window.hpp
-rw-r--r-- | src/config/ConfigManager.cpp | 4 | ||||
-rw-r--r-- | src/desktop/Window.cpp | 6 | ||||
-rw-r--r-- | src/desktop/Window.hpp | 1 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 38bf8173..4a75ca1d 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1997,8 +1997,8 @@ bool windowRuleValid(const std::string& RULE) { RULE.starts_with("maxsize") || RULE.starts_with("pseudo") || RULE.starts_with("monitor") || RULE.starts_with("idleinhibit") || RULE == "nofocus" || RULE == "noblur" || RULE == "noshadow" || RULE == "nodim" || RULE == "noborder" || RULE == "opaque" || RULE == "forceinput" || RULE == "fullscreen" || RULE == "fakefullscreen" || RULE == "nomaxsize" || RULE == "pin" || RULE == "noanim" || RULE == "dimaround" || RULE == "windowdance" || RULE == "maximize" || RULE == "keepaspectratio" || - RULE.starts_with("animation") || RULE.starts_with("rounding") || RULE.starts_with("workspace") || RULE.starts_with("bordercolor") || RULE == "forcergbx" || - RULE == "noinitialfocus" || RULE == "stayfocused" || RULE.starts_with("bordersize") || RULE.starts_with("xray") || RULE.starts_with("center") || + RULE == "focusonactivate" || RULE.starts_with("animation") || RULE.starts_with("rounding") || RULE.starts_with("workspace") || RULE.starts_with("bordercolor") || + RULE == "forcergbx" || RULE == "noinitialfocus" || RULE == "stayfocused" || RULE.starts_with("bordersize") || RULE.starts_with("xray") || RULE.starts_with("center") || RULE.starts_with("group") || RULE == "immediate" || RULE == "nearestneighbor" || RULE.starts_with("suppressevent") || RULE.starts_with("plugin:"); } diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 2b95ad4c..e87bd99c 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -671,6 +671,8 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { m_sAdditionalConfigData.dimAround = true; } else if (r.szRule == "keepaspectratio") { m_sAdditionalConfigData.keepAspectRatio = true; + } else if (r.szRule.starts_with("focusonactivate")) { + m_sAdditionalConfigData.focusOnActivate = true; } else if (r.szRule.starts_with("xray")) { CVarList vars(r.szRule, 0, ' '); @@ -745,6 +747,7 @@ void CWindow::updateDynamicRules() { m_sAdditionalConfigData.forceRGBX = false; m_sAdditionalConfigData.borderSize = -1; m_sAdditionalConfigData.keepAspectRatio = false; + m_sAdditionalConfigData.focusOnActivate = false; m_sAdditionalConfigData.xray = -1; m_sAdditionalConfigData.forceTearing = false; m_sAdditionalConfigData.nearestNeighbor = false; @@ -1282,7 +1285,8 @@ void CWindow::activate(bool force) { m_bIsUrgent = true; - if (!force && (!*PFOCUSONACTIVATE || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE))) + if (!force && + (!(*PFOCUSONACTIVATE || m_sAdditionalConfigData.focusOnActivate) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE))) return; if (m_bIsFloating) diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp index ed79c896..efccb41c 100644 --- a/src/desktop/Window.hpp +++ b/src/desktop/Window.hpp @@ -164,6 +164,7 @@ struct SWindowAdditionalConfigData { CWindowOverridableVar<bool> dimAround = false; CWindowOverridableVar<bool> forceRGBX = false; CWindowOverridableVar<bool> keepAspectRatio = false; + CWindowOverridableVar<bool> focusOnActivate = false; CWindowOverridableVar<int> xray = -1; // -1 means unset, takes precedence over the renderdata one CWindowOverridableVar<int> borderSize = -1; // -1 means unset, takes precedence over the renderdata one CWindowOverridableVar<bool> forceTearing = false; |