Add optional delay cooldown to OnInterval gestures#543
Open
siure wants to merge 5 commits intoPixlOne:mainfrom
Open
Add optional delay cooldown to OnInterval gestures#543siure wants to merge 5 commits intoPixlOne:mainfrom
siure wants to merge 5 commits intoPixlOne:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for an optional
delayfield on interval-based gestures.delayis expressed in milliseconds and rate-limits repeatedOnIntervalactivations. After an action fires, additional interval crossings are ignored until the cooldown expires.This is intended to make
OnIntervalmore precise for discrete repeated actions such as tab switching or repeated left/right navigation.Motivation
My main use case is on a Logitech MX Master 4.
I use
OnIntervalfor repeated left/right actions, including browser tab navigation. Without a cooldown, a single hand movement can cross multiple interval boundaries very quickly, which makes it easy to overshoot and trigger more actions than intended.A small delay makes the gesture much easier to control while keeping it responsive.
Example use case
{ direction: "Right"; mode: "OnInterval"; interval: 100; delay: 250; action = { type: "Keypress"; keys: ["KEY_LEFTCTRL", "KEY_TAB"]; }; } ## Behaviour - delay > 0 enables cooldown behavior - omitted delay keeps the existing behavior unchanged - after an OnInterval action fires, the next action cannot fire until delay ms have elapsed - interval crossings during the cooldown are ignored ## Implementation This PR: - adds optional delay to config::IntervalGesture - applies the same support to OnFewPixels, since it shares the same interval-based schema/runtime path - updates IntervalGesture to use a std::chrono::steady_clock-based cooldown - adds GetDelay() / SetDelay(int delay) IPC methods - adds a small example snippet to logid.example.cfg