diff options
| author | Virt <41426325+VirtCode@users.noreply.github.com> | 2025-04-10 14:54:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-10 14:54:24 +0200 |
| commit | d775686380c348efe3a2044a5ca8626505249e38 (patch) | |
| tree | 3747a6abaa7883c4b605309c5a7f360fa91fd9d5 /src/managers/KeybindManager.cpp | |
| parent | 0dc531c4a7d6849f2db61084497b3007e92f470b (diff) | |
input: add warp_on_toggle_special (#9945)
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 9a22a13a..948ef11e 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -2097,10 +2097,16 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) { } } + updateRelativeCursorCoords(); + + PHLWORKSPACEREF focusedWorkspace; + if (requestedWorkspaceIsAlreadyOpen && specialOpenOnMonitor == workspaceID) { // already open on this monitor Debug::log(LOG, "Toggling special workspace {} to closed", workspaceID); PMONITOR->setSpecialWorkspace(nullptr); + + focusedWorkspace = PMONITOR->activeWorkspace; } else { Debug::log(LOG, "Toggling special workspace {} to open", workspaceID); auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceID); @@ -2109,6 +2115,18 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) { PSPECIALWORKSPACE = g_pCompositor->createNewWorkspace(workspaceID, PMONITOR->ID, workspaceName); PMONITOR->setSpecialWorkspace(PSPECIALWORKSPACE); + + focusedWorkspace = PSPECIALWORKSPACE; + } + + const static auto PWARPONTOGGLESPECIAL = CConfigValue<Hyprlang::INT>("cursor:warp_on_toggle_special"); + + if (*PWARPONTOGGLESPECIAL > 0) { + auto PLAST = focusedWorkspace->getLastFocusedWindow(); + auto HLSurface = CWLSurface::fromResource(g_pSeatManager->state.pointerFocus.lock()); + + if (PLAST && (!HLSurface || HLSurface->getWindow())) + PLAST->warpCursor(*PWARPONTOGGLESPECIAL == 2); } return {}; |
