Skip to content

Commit

Permalink
keybinds: avoid onWindowRemoved & onWindowCreated when group has one …
Browse files Browse the repository at this point in the history
…member (hyprwm#3286)

Make moveWindowOutOfGroup behave like toggleGroup on a group with single
member, this prevents the window from moving around rabidly.
  • Loading branch information
memchr authored and thejch committed Sep 13, 2023
1 parent 5ad50d6 commit a3aae26
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/managers/KeybindManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1977,15 +1977,19 @@ void CKeybindManager::moveWindowOutOfGroup(CWindow* pWindow, const std::string&
default: direction = DIRECTION_DEFAULT;
}

g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);

const auto GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked;
if (pWindow->m_sGroupData.pNextWindow == pWindow) {
pWindow->m_sGroupData.pNextWindow = nullptr;
pWindow->updateWindowDecos();
} else {
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);

g_pKeybindManager->m_bGroupsLocked = true;
const auto GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked;
g_pKeybindManager->m_bGroupsLocked = true;

g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow, direction);
g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow, direction);

g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV;
g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV;
}

if (*BFOCUSREMOVEDWINDOW) {
g_pCompositor->focusWindow(pWindow);
Expand Down

0 comments on commit a3aae26

Please sign in to comment.