From 006228109281ed4d07ace635cf419c605d62e4a6 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 12 Sep 2022 21:05:52 +0200 Subject: added wsbind --- src/managers/KeybindManager.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/managers/KeybindManager.cpp') diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 821b0588..6b6f8f3c 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -679,7 +679,9 @@ void CKeybindManager::changeworkspace(std::string args) { } // Workspace doesn't exist, create and switch - const auto PMONITOR = g_pCompositor->getMonitorFromCursor(); + const auto BOUNDMON = g_pConfigManager->getBoundMonitorForWS(workspaceName); + + const auto PMONITOR = BOUNDMON ? BOUNDMON : g_pCompositor->getMonitorFromCursor(); const auto OLDWORKSPACE = PMONITOR->activeWorkspace; @@ -727,6 +729,12 @@ void CKeybindManager::changeworkspace(std::string args) { // mark the monitor dirty g_pHyprRenderer->damageMonitor(PMONITOR); + // some stuf with the cursor and focus + if (g_pCompositor->m_pLastMonitor != PMONITOR) + g_pCompositor->warpCursorTo(PMONITOR->vecPosition + PMONITOR->vecSize / 2.f); + + g_pCompositor->m_pLastMonitor = PMONITOR; + // focus (clears the last) g_pInputManager->refocus(); @@ -872,7 +880,12 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) { // may be null until later! auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceToMoveTo); - const auto PMONITORNEW = PWORKSPACE ? g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID) : PMONITOR; + auto PMONITORNEW = PWORKSPACE ? g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID) : PMONITOR; + if (!PWORKSPACE) { + const auto BOUNDMON = g_pConfigManager->getBoundMonitorForWS(workspaceName); + if (BOUNDMON) + PMONITORNEW = BOUNDMON; + } const auto OLDWORKSPACEIDONMONITOR = PMONITORNEW->activeWorkspace; const auto OLDWORKSPACEIDRETURN = PMONITOR->activeWorkspace; -- cgit v1.2.3