summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-11-17 21:58:22 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-11-17 21:58:22 +0000
commit5d39223239d86479ffd9639661c92006f8ba6489 (patch)
treebfb289fa0735ad781863c5972d248c0a41c5c9ce /src/managers/KeybindManager.cpp
parentd2a7e22efdc16b9ebe4b2f62b32bab8d6b6d03c5 (diff)
fix events in changeworkspace with bound ws-es
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index b27087ba..1b8a010f 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -755,7 +755,7 @@ void CKeybindManager::changeworkspace(std::string args) {
}
// If the monitor is not the one our cursor's at, warp to it.
- const bool anotherMonitor = PMONITOR != g_pCompositor->getMonitorFromCursor();
+ const bool anotherMonitor = PMONITOR != g_pCompositor->m_pLastMonitor;
if (anotherMonitor) {
Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f;
g_pCompositor->warpCursorTo(middle);
@@ -812,6 +812,8 @@ void CKeybindManager::changeworkspace(std::string args) {
const auto PWORKSPACE = g_pCompositor->createNewWorkspace(workspaceToChangeTo, PMONITOR->ID, workspaceName);
+ const bool ANOTHERMONITOR = PMONITOR == g_pCompositor->m_pLastMonitor;
+
if (!isSwitchingToPrevious)
// Remember previous workspace.
PWORKSPACE->m_iPrevWorkspaceID = OLDWORKSPACE;
@@ -849,8 +851,16 @@ void CKeybindManager::changeworkspace(std::string args) {
// focus (clears the last)
g_pInputManager->refocus();
- // Event
+ // Events
g_pEventManager->postEvent(SHyprIPCEvent{"workspace", PWORKSPACE->m_szName});
+ if (ANOTHERMONITOR) {
+ Vector2D middle = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f;
+ g_pCompositor->warpCursorTo(middle);
+
+ // event for focusedmon, as we changed.
+ g_pEventManager->postEvent(SHyprIPCEvent{"focusedmon", PMONITOR->szName + "," + PWORKSPACE->m_szName});
+ g_pCompositor->m_pLastMonitor = PMONITOR;
+ }
Debug::log(LOG, "Changed to workspace %i", workspaceToChangeTo);
}