Skip to content

Add optional delay cooldown to OnInterval gestures#543

Open
siure wants to merge 5 commits intoPixlOne:mainfrom
siure:interval-gesture-delay-minimal
Open

Add optional delay cooldown to OnInterval gestures#543
siure wants to merge 5 commits intoPixlOne:mainfrom
siure:interval-gesture-delay-minimal

Conversation

@siure
Copy link
Copy Markdown

@siure siure commented Apr 16, 2026

Summary

This PR adds support for an optional delay field on interval-based gestures.

delay is expressed in milliseconds and rate-limits repeated OnInterval activations. After an action fires, additional interval crossings are ignored until the cooldown expires.

This is intended to make OnInterval more 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 OnInterval for 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant