diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-04-14 17:51:10 +0100 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-04-14 17:51:10 +0100 |
| commit | 83f1616a65091fe2e66d054f5ef1343d755a3e0c (patch) | |
| tree | e53bd27331c4648dc8b7bdb51f270d20b9fc4d61 /src/managers/KeybindManager.cpp | |
| parent | 7ec23254fd19fe2bf5b35b2bb07623ce87a23c41 (diff) | |
keybinds: minor adjustments to workspace
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 06ff8d39..889050bc 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -736,6 +736,8 @@ void CKeybindManager::changeworkspace(std::string args) { const auto PMONITOR = g_pCompositor->m_pLastMonitor; const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace); + const bool EXPLICITPREVIOUS = args.find("previous") == 0; + if (args.find("previous") == 0) { // Do nothing if there's no previous workspace, otherwise switch to it. if (PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1) { @@ -749,9 +751,6 @@ void CKeybindManager::changeworkspace(std::string args) { else workspaceName = PCURRENTWORKSPACE->m_sPrevWorkspace.name.empty() ? std::to_string(PCURRENTWORKSPACE->m_sPrevWorkspace.iID) : PCURRENTWORKSPACE->m_sPrevWorkspace.name; - - if (!*PALLOWWORKSPACECYCLES) - PCURRENTWORKSPACE->m_sPrevWorkspace = {-1, ""}; } } else { workspaceToChangeTo = getWorkspaceIDFromString(args, workspaceName); @@ -766,7 +765,7 @@ void CKeybindManager::changeworkspace(std::string args) { g_pInputManager->m_bEmptyFocusCursorSet = false; if (workspaceToChangeTo == PCURRENTWORKSPACE->m_iID) { - if (!*PBACKANDFORTH || PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1) + if ((!*PBACKANDFORTH && !EXPLICITPREVIOUS) || PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1) return; auto pWorkspaceToChangeTo = g_pCompositor->getWorkspaceByID(PCURRENTWORKSPACE->m_sPrevWorkspace.iID); @@ -793,14 +792,16 @@ void CKeybindManager::changeworkspace(std::string args) { else g_pCompositor->focusWindow(nullptr); } - - if (*PALLOWWORKSPACECYCLES) - pWorkspaceToChangeTo->m_sPrevWorkspace = {PCURRENTWORKSPACE->m_iID, PCURRENTWORKSPACE->m_szName}; } else { pWorkspaceToChangeTo = g_pCompositor->createNewWorkspace(PCURRENTWORKSPACE->m_sPrevWorkspace.iID, PMONITOR->ID, PCURRENTWORKSPACE->m_sPrevWorkspace.name); PMONITOR->changeWorkspace(pWorkspaceToChangeTo); } + if (*PALLOWWORKSPACECYCLES) + pWorkspaceToChangeTo->m_sPrevWorkspace = {PCURRENTWORKSPACE->m_iID, PCURRENTWORKSPACE->m_szName}; + else if (!EXPLICITPREVIOUS) + pWorkspaceToChangeTo->m_sPrevWorkspace = {-1, ""}; + return; } |
