summaryrefslogtreecommitdiff
path: root/src/config/ConfigManager.cpp
diff options
context:
space:
mode:
authoralaricljs <me@mooluv.com>2025-04-12 10:43:13 -0400
committerGitHub <noreply@github.com>2025-04-12 16:43:13 +0200
commit65389700878640fa0e90419b9cf34f48e4186fca (patch)
tree55a818c23406da1742599cb2f38ba35d1fc09a6a /src/config/ConfigManager.cpp
parent0399e64274ae5c05a7a40ad78e4d4852d9957e99 (diff)
binds: add drag_threshold for click/drag isolation (#9839)
--------- Co-authored-by: Leeman <lstrout@enlj.com>
Diffstat (limited to 'src/config/ConfigManager.cpp')
-rw-r--r--src/config/ConfigManager.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 56ff3f30..70f6701e 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -651,6 +651,7 @@ CConfigManager::CConfigManager() {
registerConfigVar("binds:disable_keybind_grabbing", Hyprlang::INT{0});
registerConfigVar("binds:window_direction_monitor_fallback", Hyprlang::INT{1});
registerConfigVar("binds:allow_pin_fullscreen", Hyprlang::INT{0});
+ registerConfigVar("binds:drag_threshold", Hyprlang::INT{0});
registerConfigVar("gestures:workspace_swipe", Hyprlang::INT{0});
registerConfigVar("gestures:workspace_swipe_fingers", Hyprlang::INT{3});
@@ -2255,6 +2256,8 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
bool longPress = false;
bool hasDescription = false;
bool dontInhibit = false;
+ bool click = false;
+ bool drag = false;
const auto BINDARGS = command.substr(4);
for (auto const& arg : BINDARGS) {
@@ -2280,6 +2283,12 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
hasDescription = true;
} else if (arg == 'p') {
dontInhibit = true;
+ } else if (arg == 'c') {
+ click = true;
+ release = true;
+ } else if (arg == 'g') {
+ drag = true;
+ release = true;
} else {
return "bind: invalid flag";
}
@@ -2291,6 +2300,9 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
if (mouse && (repeat || release || locked))
return "flag m is exclusive";
+ if (click && drag)
+ return "flags c and g are mutually exclusive";
+
const int numbArgs = hasDescription ? 5 : 4;
const auto ARGS = CVarList(value, numbArgs);
@@ -2350,7 +2362,8 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
g_pKeybindManager->addKeybind(SKeybind{parsedKey.key, KEYSYMS, parsedKey.keycode, parsedKey.catchAll, MOD, MODS, HANDLER,
COMMAND, locked, m_szCurrentSubmap, DESCRIPTION, release, repeat, longPress,
- mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription, dontInhibit});
+ mouse, nonConsuming, transparent, ignoreMods, multiKey, hasDescription, dontInhibit,
+ click, drag});
}
return {};