mirror of
https://github.com/ItsDrike/hyprland-dwindle-autogroup.git
synced 2024-11-10 02:59:41 +00:00
Replicate the new moveIntoGroup behavior
Hyprland has updated some of the core functions related to groupping windows in PR: https://github.com/hyprwm/Hyprland/pull/2630 Specifically, the CWindow::insertWindowIntoGroup was updated to no longer automatically make the newly inserted window the group's head, allowing to insert windows without the group auto-focusing them. With that, the CKeybindManager::moveIntoGroup (dispatcher) function was then updated to adhere to the change in insertWindowIntoGroup and to make the inserted widow the group's head from there. It's probably possible to utilize the insertWindowIntoGroup without making the inserted window the group's head in a more clever way, however for now, this commit just changes our logic in groupCreate function to fully replicate the moveIntoGroup for each dwindle child node window. This means we're still doing what we were doing before, that is to insert a window, make it the group head, repeat for each dwindle child and at the end make the original group head the head again. The reason this fix doesn't simply skip making each of the nodes a group head is that without it, the layout doesn't seem to properly recognize that the window should no longer be shown, and while this probably can be addressed by replicating some of the CWindow::setGroupCurrent function's behavior, for now, that's a task for later.
This commit is contained in:
parent
6bc69d03d6
commit
c1c883a237
22
src/main.cpp
22
src/main.cpp
|
@ -73,11 +73,29 @@ void groupCreate(const SDwindleNodeData* PNODE, CHyprDwindleLayout* layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add all of the children nodes into the group
|
// Add all of the children nodes into the group
|
||||||
|
// (This is mostly copied logic from CKeybindManager::moveIntoGroup. Note that it
|
||||||
|
// includes support for the child node to be in another group, in which case only
|
||||||
|
// this window if moved out of that group and into this one. We don't actually
|
||||||
|
// need this logic now, because we don't support nested groups though)
|
||||||
for (auto& n : newGroupMembers) {
|
for (auto& n : newGroupMembers) {
|
||||||
auto window = n->pWindow;
|
auto window = n->pWindow;
|
||||||
layout->onWindowRemoved(window);
|
|
||||||
|
// Create a group bar decoration for the window
|
||||||
|
// (assuming it's not already in a group, in which case it should have one)
|
||||||
|
if (!window->m_sGroupData.pNextWindow)
|
||||||
|
window->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(window));
|
||||||
|
|
||||||
|
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(window); // This removes groupped property!
|
||||||
|
|
||||||
|
window->m_sGroupData.locked = false;
|
||||||
|
window->m_sGroupData.head = false;
|
||||||
|
|
||||||
PWINDOW->insertWindowToGroup(window);
|
PWINDOW->insertWindowToGroup(window);
|
||||||
window->m_dWindowDecorations.emplace_back(std::make_unique<CHyprGroupBarDecoration>(window));
|
PWINDOW->setGroupCurrent(window);
|
||||||
|
window->updateWindowDecos();
|
||||||
|
|
||||||
|
g_pLayoutManager->getCurrentLayout()->recalculateWindow(window);
|
||||||
|
g_pCompositor->focusWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Moving new windows into group makes them the active window in that group,
|
// Moving new windows into group makes them the active window in that group,
|
||||||
|
|
Loading…
Reference in a new issue