From e4e6ddb075605c3b3b48654de459796d72035f92 Mon Sep 17 00:00:00 2001 From: staz <74452129+alyanser@users.noreply.github.com> Date: Mon, 5 Jun 2023 12:44:13 +0500 Subject: [PATCH] Make movetoworkspace register previous workspace (#2436) * Make movetoworkspace register previous workspace * style: no braces + format with clang-format --- src/managers/KeybindManager.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 6efca86c..9050374c 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -881,9 +881,10 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) { return; } - auto pWorkspace = g_pCompositor->getWorkspaceByID(WORKSPACEID); - CMonitor* pMonitor = nullptr; - const auto POLDWS = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID); + auto pWorkspace = g_pCompositor->getWorkspaceByID(WORKSPACEID); + CMonitor* pMonitor = nullptr; + const auto POLDWS = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID); + static auto* const PALLOWWORKSPACECYCLES = &g_pConfigManager->getConfigValuePtr("binds:allow_workspace_cycles")->intValue; g_pHyprRenderer->damageWindow(PWINDOW); @@ -903,6 +904,9 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) { g_pCompositor->focusWindow(PWINDOW); g_pCompositor->warpCursorTo(PWINDOW->middle()); + + if (*PALLOWWORKSPACECYCLES) + pWorkspace->m_sPrevWorkspace = {POLDWS->m_iID, POLDWS->m_szName}; } void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {