From df2a0b9cd9227180a84cd77df62c0def2b79808a Mon Sep 17 00:00:00 2001 From: Lampros Pitsillos Date: Sun, 3 Sep 2023 23:42:23 +0300 Subject: [PATCH] Set limit on how many windows in special workspace --- src/Window.cpp | 8 ++++++++ src/config/ConfigManager.cpp | 1 + 2 files changed, 9 insertions(+) diff --git a/src/Window.cpp b/src/Window.cpp index cd599c82..9c93cf94 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -417,6 +417,8 @@ void CWindow::onUnmap() { void CWindow::onMap() { + static auto* const PISOLATESPECIAL = &g_pConfigManager->getConfigValuePtr("misc:isolate_special")->intValue; + m_pWLSurface.assign(g_pXWaylandManager->getWindowSurface(this)); // JIC, reset the callbacks. If any are set, we'll make sure they are cleared so we don't accidentally unset them. (In case a window got remapped) @@ -447,6 +449,12 @@ void CWindow::onMap() { hyprListener_unmapWindow.initCallback(m_bIsX11 ? &m_uSurface.xwayland->surface->events.unmap : &m_uSurface.xdg->surface->events.unmap, &Events::listener_unmapWindow, this, "CWindow"); + + if (*PISOLATESPECIAL && g_pCompositor->getWindowsOnWorkspace(m_iWorkspaceID) > *PISOLATESPECIAL && g_pCompositor->isWorkspaceSpecial(m_iWorkspaceID)) { + const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); + this->moveToWorkspace(PMONITOR->activeWorkspace); + } + } void CWindow::onBorderAngleAnimEnd(void* ptr) { diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 48b4dee5..6d1eaa5b 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -114,6 +114,7 @@ void CConfigManager::setDefaultVars() { configValues["misc:groupbar_titles_font_size"].intValue = 8; configValues["misc:groupbar_gradients"].intValue = 1; configValues["misc:close_special_on_empty"].intValue = 1; + configValues["misc:isolate_special"].intValue = 0; configValues["misc:groupbar_text_color"].intValue = 0xffffffff; configValues["misc:background_color"].intValue = 0xff111111;