From f69e72eca1a31e4780d06018fc7e09767a50969d Mon Sep 17 00:00:00 2001 From: davc0n Date: Fri, 3 Jan 2025 23:43:48 +0100 Subject: [PATCH] socket2: add focusedmonv2 event (#8921) * socket2: add focusedmonv2 event * socket2: remove workspace name from focusedmonv2 --- src/Compositor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index c8ed22df..aa6faa16 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2588,7 +2588,12 @@ void CCompositor::setActiveMonitor(PHLMONITOR pMonitor) { const auto PWORKSPACE = pMonitor->activeWorkspace; - g_pEventManager->postEvent(SHyprIPCEvent{"focusedmon", pMonitor->szName + "," + (PWORKSPACE ? PWORKSPACE->m_szName : "?")}); + const auto WORKSPACE_ID = PWORKSPACE ? std::to_string(PWORKSPACE->m_iID) : std::to_string(WORKSPACE_INVALID); + const auto WORKSPACE_NAME = PWORKSPACE ? PWORKSPACE->m_szName : "?"; + + g_pEventManager->postEvent(SHyprIPCEvent{"focusedmon", pMonitor->szName + "," + WORKSPACE_NAME}); + g_pEventManager->postEvent(SHyprIPCEvent{"focusedmonv2", pMonitor->szName + "," + WORKSPACE_ID}); + EMIT_HOOK_EVENT("focusedMon", pMonitor); m_pLastMonitor = pMonitor->self; }