diff options
| author | Vaxry <vaxry@vaxry.net> | 2026-04-02 22:34:04 +0100 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2026-04-02 22:34:04 +0100 |
| commit | ad906a473f2deffba59b40de44936e17e61f95aa (patch) | |
| tree | 9433e8aa80edfb12a301dc28511878b3e80b1260 /src/layout/supplementary/WorkspaceAlgoMatcher.cpp | |
| parent | a84e98d2a8e5c40fdad482e8e4b318feb6f5116b (diff) | |
layout: revert "replace string comparison with ID-based matching in WorkspaceAlgoMatcher (#13943)"
This reverts commit 529f72249c2cf4cefc824a612aeddf2d5f858f54.
It's not better, see https://github.com/hyprwm/Hyprland/pull/13943#issuecomment-4180474615
God damnit.
Diffstat (limited to 'src/layout/supplementary/WorkspaceAlgoMatcher.cpp')
| -rw-r--r-- | src/layout/supplementary/WorkspaceAlgoMatcher.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/layout/supplementary/WorkspaceAlgoMatcher.cpp b/src/layout/supplementary/WorkspaceAlgoMatcher.cpp index 0bf394a4..98cdb773 100644 --- a/src/layout/supplementary/WorkspaceAlgoMatcher.cpp +++ b/src/layout/supplementary/WorkspaceAlgoMatcher.cpp @@ -1,6 +1,5 @@ #include "WorkspaceAlgoMatcher.hpp" -#include <unordered_map> -#include <string> + #include "../../config/ConfigValue.hpp" #include "../../config/shared/workspace/WorkspaceRuleManager.hpp" @@ -15,8 +14,6 @@ #include "../../Compositor.hpp" -static const std::unordered_map<std::string, int> layoutIDs = {{"dwindle", 1}, {"master", 2}, {"scrolling", 3}, {"monocle", 4}, {"default", 5}, {"floating", 6}}; - using namespace Layout; using namespace Layout::Supplementary; @@ -115,7 +112,7 @@ SP<CAlgorithm> CWorkspaceAlgoMatcher::createAlgorithmForWorkspace(PHLWORKSPACE w } void CWorkspaceAlgoMatcher::updateWorkspaceLayouts() { - // TODO: fully migrate layout selection to ID-based system (comparison optimized) + // TODO: make this ID-based, string comparison is slow for (const auto& ws : g_pCompositor->getWorkspaces()) { if (!ws) continue; @@ -126,18 +123,9 @@ void CWorkspaceAlgoMatcher::updateWorkspaceLayouts() { continue; const auto LAYOUT_TO_USE = tiledAlgoForWorkspace(ws.lock()); - auto itLayout = layoutIDs.find(LAYOUT_TO_USE); - const int layoutID = (itLayout != layoutIDs.end()) ? itLayout->second : -1; - - if (m_algoNames.contains(&typeid(*TILED_ALGO.get()))) { - const auto& currentName = m_algoNames.at(&typeid(*TILED_ALGO.get())); - auto itCurrent = layoutIDs.find(currentName); - const int currentID = (itCurrent != layoutIDs.end()) ? itCurrent->second : -1; - - if (currentID == layoutID) - continue; - } + if (m_algoNames.contains(&typeid(*TILED_ALGO.get())) && m_algoNames.at(&typeid(*TILED_ALGO.get())) == LAYOUT_TO_USE) + continue; // needs a switchup ws->m_space->algorithm()->updateTiledAlgo(algoForNameTiled(LAYOUT_TO_USE)); |
