diff options
| author | memchr <memchr@proton.me> | 2024-06-16 14:42:32 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-16 16:42:32 +0200 |
| commit | 43c75f17eb9ce89f90ef443a3ae740a1bdd55d31 (patch) | |
| tree | 208ab9f06bfa8f343c36ef21104183e50853abc5 /src/managers/KeybindManager.cpp | |
| parent | 1b5444494d26624804de8f479da3cffb5d480dc6 (diff) | |
input: add cursor:warp_on_changeworkspace (#6480)
* input: add cursor:warp_on_changeworkspace
If enabled, warp the cursor to the last focused window on the workspace in the `changeworkspace' dispatcher, except if the cursor is currently on the WLR top layer.
Respect persistent warps.
* warp_on_change_workspace: check if focused layer is a window.
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index eb07850c..14fadf02 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1,6 +1,7 @@ #include "../config/ConfigValue.hpp" #include "../devices/IKeyboard.hpp" #include "../managers/SeatManager.hpp" +#include "../protocols/LayerShell.hpp" #include "../protocols/ShortcutsInhibit.hpp" #include "../render/decorations/CHyprGroupBarDecoration.hpp" #include "KeybindManager.hpp" @@ -1087,6 +1088,8 @@ void CKeybindManager::changeworkspace(std::string args) { if (!PMONITORWORKSPACEOWNER) return; + updateRelativeCursorCoords(); + g_pCompositor->setActiveMonitor(PMONITORWORKSPACEOWNER); if (BISWORKSPACECURRENT) { @@ -1115,6 +1118,16 @@ void CKeybindManager::changeworkspace(std::string args) { else g_pInputManager->simulateMouseMovement(); } + + const static auto PWARPONWORKSPACECHANGE = CConfigValue<Hyprlang::INT>("cursor:warp_on_change_workspace"); + + if (*PWARPONWORKSPACECHANGE) { + auto PLAST = pWorkspaceToChangeTo->getLastFocusedWindow(); + auto HLSurface = CWLSurface::fromResource(g_pSeatManager->state.pointerFocus.lock()); + + if (PLAST && (!HLSurface || HLSurface->getWindow())) + PLAST->warpCursor(); + } } void CKeybindManager::fullscreenActive(std::string args) { |
