diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 6f24b8b2032..ed9dad83379 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -340,8 +340,10 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir return; } + // If the active window is a group and auto_group = true: static auto AUTOGROUP = CConfigValue("group:auto_group"); - // auto group the window if OPENINGON is a tiled group + + // auto group the new tiling window if OPENINGON is a tiled group if (*AUTOGROUP && OPENINGON->pWindow->m_sGroupData.pNextWindow.lock() // target is a tiled group && pWindow->canBeGroupedInto(OPENINGON->pWindow.lock()) && !m_vOverrideFocalPoint) { // we are not moving window m_lDwindleNodesData.remove(*PNODE); @@ -359,9 +361,10 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir return; } - // auto group the window if the last window is a floating group + + // auto group the new tiling window if the focused window is a floating group const auto PLASTWINDOW = g_pCompositor->m_pLastWindow; - if (*AUTOGROUP && PLASTWINDOW && PLASTWINDOW->m_bIsFloating && PLASTWINDOW->m_sGroupData.pNextWindow // target is a floating group + if (*AUTOGROUP && PLASTWINDOW && PLASTWINDOW->m_bIsFloating && PLASTWINDOW->m_sGroupData.pNextWindow // target is the focused floating group && pWindow->canBeGroupedInto(PLASTWINDOW.lock())) { static auto USECURRPOS = CConfigValue("group:insert_after_current"); diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index ef9489e0d84..f4d79b30925 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -81,10 +81,10 @@ void IHyprLayout::onWindowRemovedFloating(PHLWINDOW pWindow) { void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) { - // auto group the window if the last window is a floating group - static auto AUTOGROUP = CConfigValue("group:auto_group"); - const auto PLASTWINDOW = g_pCompositor->m_pLastWindow; - if (*AUTOGROUP && PLASTWINDOW && PLASTWINDOW->m_bIsFloating && PLASTWINDOW->m_sGroupData.pNextWindow // target is a floating group + // auto group the new floating window if the focused window is a floating group + static auto AUTOGROUP = CConfigValue("group:auto_group"); + const auto PLASTWINDOW = g_pCompositor->m_pLastWindow; + if (*AUTOGROUP && PLASTWINDOW && PLASTWINDOW->m_bIsFloating && PLASTWINDOW->m_sGroupData.pNextWindow // target is the focused floating group && pWindow->canBeGroupedInto(PLASTWINDOW.lock())) { static auto USECURRPOS = CConfigValue("group:insert_after_current"); diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 75d13dd8a94..bf12c97129b 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -116,8 +116,10 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire return; } + // If the active window is a group and auto_group = true: static auto AUTOGROUP = CConfigValue("group:auto_group"); - // auto group the window if OPENINGON is a tiled group + + // auto group the new tiling window if OPENINGON is a tiled group if (*AUTOGROUP && OPENINGON && OPENINGON != PNODE && OPENINGON->pWindow->m_sGroupData.pNextWindow.lock() // target is a tiled group && pWindow->canBeGroupedInto(OPENINGON->pWindow.lock())) { @@ -136,9 +138,10 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire return; } - // auto group the window if the last window is a floating group + + // auto group the new tiling window if the focused window is a floating group const auto PLASTWINDOW = g_pCompositor->m_pLastWindow; - if (*AUTOGROUP && PLASTWINDOW && PLASTWINDOW->m_bIsFloating && PLASTWINDOW->m_sGroupData.pNextWindow // target is a floating group + if (*AUTOGROUP && PLASTWINDOW && PLASTWINDOW->m_bIsFloating && PLASTWINDOW->m_sGroupData.pNextWindow // target is the focused floating group && pWindow->canBeGroupedInto(PLASTWINDOW.lock())) { m_lMasterNodesData.remove(*PNODE);