From ad906a473f2deffba59b40de44936e17e61f95aa Mon Sep 17 00:00:00 2001 From: Vaxry Date: Thu, 2 Apr 2026 22:34:04 +0100 Subject: [PATCH] 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. --- .../supplementary/WorkspaceAlgoMatcher.cpp | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/layout/supplementary/WorkspaceAlgoMatcher.cpp b/src/layout/supplementary/WorkspaceAlgoMatcher.cpp index 0bf394a4b..98cdb773c 100644 --- a/src/layout/supplementary/WorkspaceAlgoMatcher.cpp +++ b/src/layout/supplementary/WorkspaceAlgoMatcher.cpp @@ -1,6 +1,5 @@ #include "WorkspaceAlgoMatcher.hpp" -#include -#include + #include "../../config/ConfigValue.hpp" #include "../../config/shared/workspace/WorkspaceRuleManager.hpp" @@ -15,8 +14,6 @@ #include "../../Compositor.hpp" -static const std::unordered_map 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 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));