Skip to content

Commit

Permalink
keybinds: fix move to prev ws, moved to same mon (#6688)
Browse files Browse the repository at this point in the history
Co-authored-by: Крылов Александр <[email protected]>
  • Loading branch information
Truenya and Крылов Александр committed Jun 27, 2024
1 parent f2dc48d commit b7f42a1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/managers/KeybindManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,14 +1048,20 @@ SWorkspaceIDName getWorkspaceToChangeFromArgs(std::string args, PHLWORKSPACE PCU
return {WORKSPACE_NOT_CHANGED, ""};
}

const auto ID = PCURRENTWORKSPACE->m_iID;
if (const auto PWORKSPACETOCHANGETO = g_pCompositor->getWorkspaceByID(PPREVWS.id); PWORKSPACETOCHANGETO) {
if (PER_MON && PCURRENTWORKSPACE->m_iMonitorID != PWORKSPACETOCHANGETO->m_iMonitorID)
return {WORKSPACE_NOT_CHANGED, ""};
const auto ID = PCURRENTWORKSPACE->m_iID;
const auto PWORKSPACETOCHANGETO = g_pCompositor->getWorkspaceByID(PPREVWS.id);
if (!PWORKSPACETOCHANGETO)
return {ID, PPREVWS.name.empty() ? std::to_string(PPREVWS.id) : PPREVWS.name};

if (!PER_MON || PCURRENTWORKSPACE->m_iMonitorID == PWORKSPACETOCHANGETO->m_iMonitorID)
return {ID, PWORKSPACETOCHANGETO->m_szName};
}

return {ID, PPREVWS.name.empty() ? std::to_string(PPREVWS.id) : PPREVWS.name};
// PER_MON and cur ws is not on same monitor with prev per monitor
const auto POTHERWSTOCHANGETO = g_pCompositor->getWorkspaceByID(PCURRENTWORKSPACE->getPrevWorkspaceIDName(false).id);
if (POTHERWSTOCHANGETO && POTHERWSTOCHANGETO->m_iMonitorID == PCURRENTWORKSPACE->m_iMonitorID)
return {ID, POTHERWSTOCHANGETO->m_szName};

return {WORKSPACE_NOT_CHANGED, ""};
}

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

0 comments on commit b7f42a1

Please sign in to comment.