diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 1cff5280..448ff410 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -161,6 +161,7 @@ void CConfigManager::setDefaultVars() { configValues["gestures:workspace_swipe_min_speed_to_force"].intValue = 30; configValues["gestures:workspace_swipe_cancel_ratio"].floatValue = 0.5f; configValues["gestures:workspace_swipe_create_new"].intValue = 1; + configValues["gestures:workspace_swipe_forever"].intValue = 0; configValues["input:follow_mouse"].intValue = 1; diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index 81f84c9b..a020fade 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -147,6 +147,9 @@ private: wlr_surface* m_pFoundSurfaceToFocus = nullptr; SLayerSurface* m_pFoundLSToFocus = nullptr; CWindow* m_pFoundWindowToFocus = nullptr; + + // swipe + void beginWorkspaceSwipe(); }; inline std::unique_ptr g_pInputManager; diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp index 1d462ccf..50763519 100644 --- a/src/managers/input/Swipe.cpp +++ b/src/managers/input/Swipe.cpp @@ -19,6 +19,10 @@ void CInputManager::onSwipeBegin(wlr_pointer_swipe_begin_event* e) { if (onMonitor < 2 && !*PSWIPENEW) return; // disallow swiping when there's 1 workspace on a monitor + beginWorkspaceSwipe(); +} + +void CInputManager::beginWorkspaceSwipe() { const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace); Debug::log(LOG, "Starting a swipe from %s", PWORKSPACE->m_szName.c_str()); @@ -162,6 +166,7 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) { static auto *const PSWIPEDIST = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance")->intValue; static auto *const PSWIPEINVR = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_invert")->intValue; static auto *const PSWIPENEW = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_create_new")->intValue; + static auto *const PSWIPEFOREVER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_forever")->intValue; const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert"; @@ -258,4 +263,11 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) { g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID); + + if (*PSWIPEFOREVER) { + if (abs(m_sActiveSwipe.delta) >= *PSWIPEDIST) { + onSwipeEnd(nullptr); + beginWorkspaceSwipe(); + } + } } \ No newline at end of file