diff options
| author | darkwater <dark@dark.red> | 2024-09-09 11:10:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-09 10:10:08 +0100 |
| commit | 04421063af2941c6e27e6dca2bdc2c387778a3a5 (patch) | |
| tree | 5a8679356e295afb9c59a7fd49c65ef1a57a8f3d /src | |
| parent | 43e1415e715bb6c6c4ea722ba839210938ac2b07 (diff) | |
config: add order rule for layers (#7697)
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/ConfigManager.cpp | 2 | ||||
| -rw-r--r-- | src/desktop/LayerSurface.cpp | 5 | ||||
| -rw-r--r-- | src/desktop/LayerSurface.hpp | 1 | ||||
| -rw-r--r-- | src/render/Renderer.cpp | 4 |
4 files changed, 11 insertions, 1 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 852994a7..57cd2350 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2239,7 +2239,7 @@ bool windowRuleValid(const std::string& RULE) { bool layerRuleValid(const std::string& RULE) { static const auto rules = std::unordered_set<std::string>{"noanim", "blur", "blurpopups", "dimaround"}; - static const auto rulesPrefix = std::vector<std::string>{"ignorealpha", "ignorezero", "xray", "animation"}; + static const auto rulesPrefix = std::vector<std::string>{"ignorealpha", "ignorezero", "xray", "animation", "order"}; return rules.contains(RULE) || std::any_of(rulesPrefix.begin(), rulesPrefix.end(), [&RULE](auto prefix) { return RULE.starts_with(prefix); }); } diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp index 155a2605..0e7e71b6 100644 --- a/src/desktop/LayerSurface.cpp +++ b/src/desktop/LayerSurface.cpp @@ -394,6 +394,11 @@ void CLayerSurface::applyRules() { } else if (rule.rule.starts_with("animation")) { CVarList vars{rule.rule, 2, 's'}; animationStyle = vars[1]; + } else if (rule.rule.starts_with("order")) { + CVarList vars{rule.rule, 2, 's'}; + try { + order = std::stoi(vars[1]); + } catch (...) { Debug::log(ERR, "Invalid value passed to order"); } } } } diff --git a/src/desktop/LayerSurface.hpp b/src/desktop/LayerSurface.hpp index 84935b34..e0f17039 100644 --- a/src/desktop/LayerSurface.hpp +++ b/src/desktop/LayerSurface.hpp @@ -55,6 +55,7 @@ class CLayerSurface { bool ignoreAlpha = false; float ignoreAlphaValue = 0.f; bool dimAround = false; + int64_t order = 0; std::optional<std::string> animationStyle; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 27fde129..08bf76cb 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1742,6 +1742,10 @@ void CHyprRenderer::arrangeLayersForMonitor(const MONITORID& monitor) { CBox usableArea = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; + for (auto& la : PMONITOR->m_aLayerSurfaceLayers) { + std::stable_sort(la.begin(), la.end(), [](const PHLLSREF& a, const PHLLSREF& b) { return a->order > b->order; }); + } + for (auto const& la : PMONITOR->m_aLayerSurfaceLayers) arrangeLayerArray(PMONITOR, la, true, &usableArea); |
