mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-29 22:26:00 +01:00
layout: fix auto group when opening a new window in a non-focused workspace using window rules (#8006)
This commit is contained in:
parent
0c7a7e2d56
commit
6807430b18
1 changed files with 15 additions and 14 deletions
|
@ -181,33 +181,34 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IHyprLayout::onWindowCreatedAutoGroup(PHLWINDOW pWindow) {
|
bool IHyprLayout::onWindowCreatedAutoGroup(PHLWINDOW pWindow) {
|
||||||
static auto AUTOGROUP = CConfigValue<Hyprlang::INT>("group:auto_group");
|
static auto PAUTOGROUP = CConfigValue<Hyprlang::INT>("group:auto_group");
|
||||||
if ((*AUTOGROUP || g_pInputManager->m_bWasDraggingWindow) // check if auto_group is enabled, or, if the user is manually dragging the window into the group.
|
PHLWINDOW OPENINGON = g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow->m_pWorkspace == pWindow->m_pWorkspace ?
|
||||||
&& g_pCompositor->m_pLastWindow.lock() // check if a focused window exists.
|
g_pCompositor->m_pLastWindow.lock() :
|
||||||
&& g_pCompositor->m_pLastWindow != pWindow // fixes a freeze when activating togglefloat to transform a floating group into a tiled group.
|
g_pCompositor->getFirstWindowOnWorkspace(pWindow->workspaceID());
|
||||||
&& g_pCompositor->m_pLastWindow->m_pWorkspace ==
|
|
||||||
pWindow
|
if ((*PAUTOGROUP || g_pInputManager->m_bWasDraggingWindow) // check if auto_group is enabled, or, if the user is manually dragging the window into the group.
|
||||||
->m_pWorkspace // fix for multimonitor: when there is a focused group in monitor 1 and monitor 2 is empty, this enables adding the first window of monitor 2 when using the mouse to focus it.
|
&& OPENINGON // check if OPENINGON exists.
|
||||||
&& g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow.lock() // check if the focused window is a group
|
&& OPENINGON != pWindow // fixes a freeze when activating togglefloat to transform a floating group into a tiled group.
|
||||||
&& pWindow->canBeGroupedInto(g_pCompositor->m_pLastWindow.lock()) // check if the new window can be grouped into the focused group
|
&& OPENINGON->m_sGroupData.pNextWindow.lock() // check if OPENINGON is a group
|
||||||
|
&& pWindow->canBeGroupedInto(OPENINGON) // check if the new window can be grouped into OPENINGON
|
||||||
&& !g_pXWaylandManager->shouldBeFloated(pWindow)) { // don't group XWayland windows that should be floated.
|
&& !g_pXWaylandManager->shouldBeFloated(pWindow)) { // don't group XWayland windows that should be floated.
|
||||||
|
|
||||||
switch (pWindow->m_bIsFloating) {
|
switch (pWindow->m_bIsFloating) {
|
||||||
case false:
|
case false:
|
||||||
if (g_pCompositor->m_pLastWindow->m_bIsFloating)
|
if (OPENINGON->m_bIsFloating)
|
||||||
pWindow->m_bIsFloating = true;
|
pWindow->m_bIsFloating = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case true:
|
case true:
|
||||||
if (!g_pCompositor->m_pLastWindow->m_bIsFloating)
|
if (!OPENINGON->m_bIsFloating)
|
||||||
pWindow->m_bIsFloating = false;
|
pWindow->m_bIsFloating = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
||||||
(*USECURRPOS ? g_pCompositor->m_pLastWindow : g_pCompositor->m_pLastWindow->getGroupTail())->insertWindowToGroup(pWindow);
|
(*USECURRPOS ? OPENINGON : OPENINGON->getGroupTail())->insertWindowToGroup(pWindow);
|
||||||
|
|
||||||
g_pCompositor->m_pLastWindow->setGroupCurrent(pWindow);
|
OPENINGON->setGroupCurrent(pWindow);
|
||||||
pWindow->applyGroupRules();
|
pWindow->applyGroupRules();
|
||||||
pWindow->updateWindowDecos();
|
pWindow->updateWindowDecos();
|
||||||
recalculateWindow(pWindow);
|
recalculateWindow(pWindow);
|
||||||
|
|
Loading…
Reference in a new issue