summaryrefslogtreecommitdiff
path: root/src/desktop/Workspace.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-07-27 18:46:23 +0200
committerGitHub <noreply@github.com>2025-07-27 18:46:23 +0200
commitc63d0003a1e5155248695f19778f815a8ad34c67 (patch)
tree9bf619bbec83cbcb098840b39c838012ecba611b /src/desktop/Workspace.cpp
parent5d4b4ecbfb117c36385a454aba0ef897398f5e74 (diff)
core: fix workspace persistence tracking (#11239)
Diffstat (limited to 'src/desktop/Workspace.cpp')
-rw-r--r--src/desktop/Workspace.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp
index 49882534..c14d6e38 100644
--- a/src/desktop/Workspace.cpp
+++ b/src/desktop/Workspace.cpp
@@ -44,7 +44,7 @@ void CWorkspace::init(PHLWORKSPACE self) {
m_inert = false;
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(self);
- m_persistent = WORKSPACERULE.isPersistent;
+ setPersistent(WORKSPACERULE.isPersistent);
if (self->m_wasCreatedEmpty)
if (auto cmd = WORKSPACERULE.onCreatedEmptyRunCmd)
@@ -639,7 +639,7 @@ void CWorkspace::rename(const std::string& name) {
m_name = name;
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(m_self.lock());
- m_persistent = WORKSPACERULE.isPersistent;
+ setPersistent(WORKSPACERULE.isPersistent);
if (WORKSPACERULE.isPersistent)
g_pCompositor->ensurePersistentWorkspacesPresent(std::vector<SWorkspaceRule>{WORKSPACERULE}, m_self.lock());
@@ -658,3 +658,19 @@ void CWorkspace::updateWindows() {
w->updateDynamicRules();
}
}
+
+void CWorkspace::setPersistent(bool persistent) {
+ if (m_persistent == persistent)
+ return;
+
+ m_persistent = persistent;
+
+ if (persistent)
+ m_selfPersistent = m_self.lock();
+ else
+ m_selfPersistent.reset();
+}
+
+bool CWorkspace::isPersistent() {
+ return m_persistent;
+}