From 590fbf808b60baceef3b021050dae4c409121bf5 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 1 Oct 2022 10:38:43 +0100 Subject: [PATCH] send a focusedmon event on focus change mon --- src/managers/KeybindManager.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index ae0dff0f..df079412 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -987,7 +987,15 @@ void CKeybindManager::moveFocusTo(std::string args) { g_pCompositor->focusWindow(PWINDOWTOCHANGETO); Vector2D middle = PWINDOWTOCHANGETO->m_vRealPosition.goalv() + PWINDOWTOCHANGETO->m_vRealSize.goalv() / 2.f; g_pCompositor->warpCursorTo(middle); - g_pCompositor->m_pLastMonitor = g_pCompositor->getMonitorFromID(PWINDOWTOCHANGETO->m_iMonitorID); // update last monitor + + if (PWINDOWTOCHANGETO->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID) { + // event + const auto PNEWMON = g_pCompositor->getMonitorFromID(PWINDOWTOCHANGETO->m_iMonitorID); + const auto PNEWWS = g_pCompositor->getWorkspaceByID(PNEWMON->activeWorkspace); + g_pEventManager->postEvent(SHyprIPCEvent{"focusedmon", PNEWMON->szName + "," + PNEWWS->m_szName}); + + g_pCompositor->m_pLastMonitor = PNEWMON; + } } };