workspacerules: Add new optional "default command" for auto-launching apps on new workspaces (#3559)

This commit is contained in:
Brenno Lemos
2023-10-22 19:11:03 -03:00
committed by GitHub
parent 59f27e7f57
commit b135bd6cd4
8 changed files with 100 additions and 30 deletions

View File

@@ -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);
if (PMONITOR && PMONITOR->specialWorkspaceID == WORKSPACE->m_iID)
PMONITOR->setSpecialWorkspace(nullptr);
}
const auto PMONITOR = getMonitorFromID((*it)->m_iMonitorID);
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;