From bab2f6a664a67dfd0c2f442dbc0134ef7c6e07e2 Mon Sep 17 00:00:00 2001 From: thejch <66577496+thejch@users.noreply.github.com> Date: Fri, 20 Oct 2023 10:01:04 -0700 Subject: [PATCH] master: fix movewindow across monitors (#3628) --- src/layout/MasterLayout.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index f44e04e3..ebbcc805 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -928,7 +928,16 @@ void CHyprMasterLayout::moveWindowTo(CWindow* pWindow, const std::string& dir) { const auto PWINDOW2 = g_pCompositor->getWindowInDirection(pWindow, dir[0]); - switchWindows(pWindow, PWINDOW2); + if (pWindow->m_iWorkspaceID != PWINDOW2->m_iWorkspaceID) { + // if different monitors, send to monitor + onWindowRemovedTiling(pWindow); + pWindow->moveToWorkspace(PWINDOW2->m_iWorkspaceID); + pWindow->m_iMonitorID = PWINDOW2->m_iMonitorID; + onWindowCreatedTiling(pWindow); + } else { + // if same monitor, switch windows + switchWindows(pWindow, PWINDOW2); + } } void CHyprMasterLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {