Skip to content

Commit

Permalink
save previous workspace before change
Browse files Browse the repository at this point in the history
  • Loading branch information
shezdy committed May 22, 2024
1 parent 155ae37 commit 3d099ff
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/managers/KeybindManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,14 @@ void CKeybindManager::changeworkspace(std::string args) {

g_pCompositor->setActiveMonitor(PMONITORWORKSPACEOWNER);

if (BISWORKSPACECURRENT) {
if (*PALLOWWORKSPACECYCLES)
pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE);
else if (!EXPLICITPREVIOUS && !*PBACKANDFORTH)
pWorkspaceToChangeTo->rememberPrevWorkspace(nullptr);
} else
pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE);

PMONITORWORKSPACEOWNER->changeWorkspace(pWorkspaceToChangeTo, false, true);

if (PMONITOR != PMONITORWORKSPACEOWNER) {
Expand All @@ -1083,14 +1091,6 @@ void CKeybindManager::changeworkspace(std::string args) {
g_pCompositor->warpCursorTo(middle);
}

if (BISWORKSPACECURRENT) {
if (*PALLOWWORKSPACECYCLES)
pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE);
else if (!EXPLICITPREVIOUS && !*PBACKANDFORTH)
pWorkspaceToChangeTo->rememberPrevWorkspace(nullptr);
} else
pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE);

if (!g_pInputManager->m_bLastFocusOnLS) {
if (g_pCompositor->m_pLastFocus)
g_pInputManager->sendMotionEventsToFocused();
Expand Down Expand Up @@ -1163,13 +1163,14 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
else if (POLDWS->m_bIsSpecialWorkspace)
g_pCompositor->getMonitorFromID(POLDWS->m_iMonitorID)->setSpecialWorkspace(nullptr);

if (*PALLOWWORKSPACECYCLES)
pWorkspace->rememberPrevWorkspace(POLDWS);

pMonitor->changeWorkspace(pWorkspace);

g_pCompositor->focusWindow(PWINDOW);
g_pCompositor->warpCursorTo(PWINDOW->middle());

if (*PALLOWWORKSPACECYCLES)
pWorkspace->rememberPrevWorkspace(POLDWS);
}

void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
Expand Down

0 comments on commit 3d099ff

Please sign in to comment.