diff options
| author | André Silva <123550+andresilva@users.noreply.github.com> | 2026-02-28 18:19:29 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-28 18:19:29 +0000 |
| commit | e333a330c0ddb07db39028fa8b3a47b3f7d21b5f (patch) | |
| tree | 5bc786b0ccc50ec6461e8d57759ab41489475485 | |
| parent | 1c64ef06d9cb555fc562345c172c45e95c3b3077 (diff) | |
desktop/group: fix movegroupwindow not following focus (#13426)
| -rw-r--r-- | hyprtester/src/tests/main/groups.cpp | 28 | ||||
| -rw-r--r-- | src/desktop/view/Group.cpp | 2 |
2 files changed, 30 insertions, 0 deletions
diff --git a/hyprtester/src/tests/main/groups.cpp b/hyprtester/src/tests/main/groups.cpp index 3cf15851..6e7375ef 100644 --- a/hyprtester/src/tests/main/groups.cpp +++ b/hyprtester/src/tests/main/groups.cpp @@ -127,6 +127,34 @@ static bool test() { ret = 1; } + // test movegroupwindow: focus should follow the moved window + NLog::log("{}Test movegroupwindow focus follows window", Colors::YELLOW); + try { + auto str = getFromSocket("/activewindow"); + auto activeBeforeMove = std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16); + OK(getFromSocket("/dispatch movegroupwindow f")); + str = getFromSocket("/activewindow"); + auto activeAfterMove = std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16); + EXPECT(activeAfterMove, activeBeforeMove); + } catch (...) { + NLog::log("{}Fail at getting prop", Colors::RED); + ret = 1; + } + + // and backwards + NLog::log("{}Test movegroupwindow backwards", Colors::YELLOW); + try { + auto str = getFromSocket("/activewindow"); + auto activeBeforeMove = std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16); + OK(getFromSocket("/dispatch movegroupwindow b")); + str = getFromSocket("/activewindow"); + auto activeAfterMove = std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16); + EXPECT(activeAfterMove, activeBeforeMove); + } catch (...) { + NLog::log("{}Fail at getting prop", Colors::RED); + ret = 1; + } + NLog::log("{}Disable autogrouping", Colors::YELLOW); OK(getFromSocket("/keyword group:auto_group false")); diff --git a/src/desktop/view/Group.cpp b/src/desktop/view/Group.cpp index 67a89986..a14ea0be 100644 --- a/src/desktop/view/Group.cpp +++ b/src/desktop/view/Group.cpp @@ -317,6 +317,7 @@ void CGroup::swapWithNext() { size_t idx = m_current + 1 >= m_windows.size() ? 0 : m_current + 1; std::iter_swap(m_windows.begin() + m_current, m_windows.begin() + idx); + m_current = idx; updateWindowVisibility(); @@ -329,6 +330,7 @@ void CGroup::swapWithLast() { size_t idx = m_current == 0 ? m_windows.size() - 1 : m_current - 1; std::iter_swap(m_windows.begin() + m_current, m_windows.begin() + idx); + m_current = idx; updateWindowVisibility(); |
