summaryrefslogtreecommitdiff
path: root/src/Compositor.cpp
diff options
context:
space:
mode:
authorBrenno Lemos <brenno@syndel.is>2023-10-22 19:11:03 -0300
committerGitHub <noreply@github.com>2023-10-22 23:11:03 +0100
commitb135bd6cd4c27a9fd94dfa084e75188463c2eb3b (patch)
tree74f04ca3dd010c41f0fd323187bfd916747da151 /src/Compositor.cpp
parent59f27e7f570170783ac01fb46a0ff90e14de53e6 (diff)
workspacerules: Add new optional "default command" for auto-launching apps on new workspaces (#3559)
Diffstat (limited to 'src/Compositor.cpp')
-rw-r--r--src/Compositor.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index cc9d4244..20656243 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -1194,24 +1194,33 @@ void CCompositor::sanityCheckWorkspaces() {
continue;
}
- const auto WINDOWSONWORKSPACE = getWindowsOnWorkspace((*it)->m_iID);
+ const auto& WORKSPACE = *it;
+ const auto WINDOWSONWORKSPACE = getWindowsOnWorkspace(WORKSPACE->m_iID);
- if ((WINDOWSONWORKSPACE == 0 && !isWorkspaceVisible((*it)->m_iID))) {
+ if (WINDOWSONWORKSPACE == 0) {
+ if (!isWorkspaceVisible(WORKSPACE->m_iID)) {
- if ((*it)->m_bIsSpecialWorkspace) {
- if ((*it)->m_fAlpha.fl() > 0.f /* don't abruptly end the fadeout */) {
- ++it;
- continue;
- }
+ if (WORKSPACE->m_bIsSpecialWorkspace) {
+ if (WORKSPACE->m_fAlpha.fl() > 0.f /* don't abruptly end the fadeout */) {
+ ++it;
+ continue;
+ }
+
+ const auto PMONITOR = getMonitorFromID(WORKSPACE->m_iMonitorID);
- const auto PMONITOR = getMonitorFromID((*it)->m_iMonitorID);
+ if (PMONITOR && PMONITOR->specialWorkspaceID == WORKSPACE->m_iID)
+ PMONITOR->setSpecialWorkspace(nullptr);
+ }
- if (PMONITOR && PMONITOR->specialWorkspaceID == (*it)->m_iID)
- PMONITOR->setSpecialWorkspace(nullptr);
+ it = m_vWorkspaces.erase(it);
+ continue;
}
+ if (!WORKSPACE->m_bOnCreatedEmptyExecuted) {
+ if (auto cmd = WORKSPACERULE.onCreatedEmptyRunCmd)
+ g_pKeybindManager->spawn(*cmd);
- it = m_vWorkspaces.erase(it);
- continue;
+ WORKSPACE->m_bOnCreatedEmptyExecuted = true;
+ }
}
++it;