summaryrefslogtreecommitdiff
path: root/src/managers/input/Swipe.cpp
diff options
context:
space:
mode:
authorJohn M. Harris, Jr <johnmh@johnmh.me>2024-06-07 10:54:08 -0700
committerGitHub <noreply@github.com>2024-06-07 19:54:08 +0200
commit40ce17bbbd6b01c7d5061358e5ff318122759a9e (patch)
treefa1ff0c9829c45e204b37bc570920e4b5fdde071 /src/managers/input/Swipe.cpp
parent41e1147dfc3319ccac0ed11bbbe8f3c77f8b635f (diff)
gestures: Add gestures:workspace_swipe_min_fingers option (#6342)
When gestures:workspace_swipe_min_fingers is enabled, gestures:workspace_swipe_fingers is considered to be the minimum number of fingers required to swipe. This behavior is more similar to sway and macOS's default behavior. For example, this allows you to set workspace_swipe_fingers to 3, but swipe with 4 or more fingers instead of 3.
Diffstat (limited to 'src/managers/input/Swipe.cpp')
-rw-r--r--src/managers/input/Swipe.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp
index 44623671..a605fea7 100644
--- a/src/managers/input/Swipe.cpp
+++ b/src/managers/input/Swipe.cpp
@@ -3,13 +3,14 @@
#include "../../config/ConfigValue.hpp"
void CInputManager::onSwipeBegin(IPointer::SSwipeBeginEvent e) {
- static auto PSWIPE = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe");
- static auto PSWIPEFINGERS = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_fingers");
- static auto PSWIPENEW = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_create_new");
+ static auto PSWIPE = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe");
+ static auto PSWIPEFINGERS = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_fingers");
+ static auto PSWIPEMINFINGERS = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_min_fingers");
+ static auto PSWIPENEW = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_create_new");
EMIT_HOOK_EVENT_CANCELLABLE("swipeBegin", e);
- if (e.fingers != *PSWIPEFINGERS || *PSWIPE == 0 || g_pSessionLockManager->isSessionLocked())
+ if ((!*PSWIPEMINFINGERS && e.fingers != *PSWIPEFINGERS) || (*PSWIPEMINFINGERS && e.fingers < *PSWIPEFINGERS) || *PSWIPE == 0 || g_pSessionLockManager->isSessionLocked())
return;
int onMonitor = 0;