diff options
author | vaxerski <[email protected]> | 2023-03-16 16:39:40 +0000 |
---|---|---|
committer | vaxerski <[email protected]> | 2023-03-16 16:40:28 +0000 |
commit | 606cb2832aff2c7305da1f880ce732f7eb464d04 (patch) | |
tree | bd53ab5bb47a8af41bd0d2ee483041cb09f9017a | |
parent | 4b52c1e68f8a29666935a92cc305afb6247f25e8 (diff) | |
download | Hyprland-606cb2832aff2c7305da1f880ce732f7eb464d04.tar.gz Hyprland-606cb2832aff2c7305da1f880ce732f7eb464d04.zip |
keybinds: remember last workspace on focusmonitor
-rw-r--r-- | src/managers/KeybindManager.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 3b0a6678..d6cffd41 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1394,7 +1394,18 @@ void CKeybindManager::focusMonitor(std::string arg) { if (!PMONITOR || PMONITOR == g_pCompositor->m_pLastMonitor) return; + const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace); + changeworkspace("[internal]" + std::to_string(PMONITOR->activeWorkspace)); + + // remember last workspace (internal calls don't preserve it) + + const auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace); + if (PNEWWORKSPACE == PWORKSPACE) + return; + + PNEWWORKSPACE->m_sPrevWorkspace.iID = PWORKSPACE->m_iID; + PNEWWORKSPACE->m_sPrevWorkspace.name = PWORKSPACE->m_szName; } void CKeybindManager::moveCursorToCorner(std::string arg) { |