diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-09-03 13:00:02 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-09-03 13:00:06 +0200 |
| commit | 5e0cf7d6a511cc9c2c070e502cb2dc68fce6e611 (patch) | |
| tree | a411adf15267ede928ded14244ddece104a7a679 /src | |
| parent | 01c6c5ae22b092c683096831978f77b6b532eca6 (diff) | |
special: add misc:close_special_on_empty
fixes #3156
Diffstat (limited to 'src')
| -rw-r--r-- | src/Window.cpp | 8 | ||||
| -rw-r--r-- | src/config/ConfigManager.cpp | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/Window.cpp b/src/Window.cpp index d0465023..b29d87e0 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -386,6 +386,8 @@ void unregisterVar(void* ptr) { } void CWindow::onUnmap() { + static auto* const PCLOSEONLASTSPECIAL = &g_pConfigManager->getConfigValuePtr("misc:close_special_on_empty")->intValue; + if (g_pCompositor->m_pLastWindow == this) g_pCompositor->m_pLastWindow = nullptr; @@ -405,6 +407,12 @@ void CWindow::onUnmap() { m_pWLSurface.unassign(); hyprListener_unmapWindow.removeCallback(); + + if (*PCLOSEONLASTSPECIAL && g_pCompositor->getWindowsOnWorkspace(m_iWorkspaceID) == 0 && g_pCompositor->isWorkspaceSpecial(m_iWorkspaceID)) { + const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); + if (PMONITOR) + PMONITOR->setSpecialWorkspace(nullptr); + } } void CWindow::onMap() { diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index ce9da11b..48b4dee5 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -113,6 +113,7 @@ void CConfigManager::setDefaultVars() { configValues["misc:render_titles_in_groupbar"].intValue = 1; configValues["misc:groupbar_titles_font_size"].intValue = 8; configValues["misc:groupbar_gradients"].intValue = 1; + configValues["misc:close_special_on_empty"].intValue = 1; configValues["misc:groupbar_text_color"].intValue = 0xffffffff; configValues["misc:background_color"].intValue = 0xff111111; |
