From c63d0003a1e5155248695f19778f815a8ad34c67 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sun, 27 Jul 2025 18:46:23 +0200 Subject: core: fix workspace persistence tracking (#11239) --- src/Compositor.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index cf1a7cb4..14f9ee63 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -3109,6 +3109,8 @@ void CCompositor::ensurePersistentWorkspacesPresent(const std::vector persistentFound; + for (const auto& rule : rules) { if (!rule.isPersistent) continue; @@ -3142,17 +3144,20 @@ void CCompositor::ensurePersistentWorkspacesPresent(const std::vectorm_id : m_lastMonitor->m_id, wsname, false); + PWORKSPACE = createNewWorkspace(id, PMONITOR ? PMONITOR->m_id : m_lastMonitor->m_id, wsname, false); } - if (PWORKSPACE) - PWORKSPACE->m_persistent = true; - if (!PMONITOR) { Debug::log(ERR, "ensurePersistentWorkspacesPresent: couldn't resolve monitor for {}, skipping", rule.monitor); continue; } + if (PWORKSPACE) + PWORKSPACE->setPersistent(true); + + if (!pWorkspace) + persistentFound.emplace_back(PWORKSPACE); + if (PWORKSPACE) { if (PWORKSPACE->m_monitor == PMONITOR) { Debug::log(LOG, "ensurePersistentWorkspacesPresent: workspace persistent {} already on {}", rule.workspaceString, PMONITOR->m_name); @@ -3165,4 +3170,22 @@ void CCompositor::ensurePersistentWorkspacesPresent(const std::vector toDowngrade; + for (auto& w : getWorkspaces()) { + if (!w->isPersistent()) + continue; + + if (std::ranges::contains(persistentFound, w.lock())) + continue; + + toDowngrade.emplace_back(w); + } + + for (auto& ws : toDowngrade) { + ws->setPersistent(false); + } + } } -- cgit v1.2.3