feat: make key repeat delay and interval configurable - #469
Open
rengers wants to merge 1 commit into
Open
Conversation
The macOS and Windows emulation backends regenerate key repeats themselves (the OS does not auto-repeat synthetic key events), but the repeat delay and interval were hardcoded to 500 ms / 32 ms. Add `key_repeat_delay` and `key_repeat_interval` config options (in milliseconds) so they can be tuned, falling back to the previous defaults when unset. - input-emulation: add `EmulationOptions` (Default = 500 ms / 32 ms) and thread it through `InputEmulation::new` / `with_backend` into the macOS and Windows backends. Other backends leave key repeat to the OS and ignore it. - config: add the two optional fields and a `Config::emulation_options()` accessor that maps them onto `EmulationOptions`. - document the new options in config.toml and the README.
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
On macOS and Windows the OS does not auto-repeat synthetic key events, so
lan-mouse regenerates key repeats itself. The repeat delay and interval were
hardcoded to 500 ms / 32 ms, which can feel off compared to the sender's own
keyboard settings. This makes both values configurable, defaulting to the
current behaviour when unset.
Changes
input-emulation: addEmulationOptions { key_repeat_delay, key_repeat_interval }(withDefault= 500 ms / 32 ms, exposed viaDEFAULT_KEY_REPEAT_DELAY/DEFAULT_KEY_REPEAT_INTERVAL) and thread itthrough
InputEmulation::new/with_backendinto the macOS and Windowsbackends, replacing the per-backend hardcoded constants. The other backends
leave key repeat to the OS and ignore the value (guarded so there are no
unused-variable warnings on those targets).
key_repeat_delay/key_repeat_interval(milliseconds) and a
Config::emulation_options()accessor that maps themonto
EmulationOptions, falling back to the defaults per field.config.tomland the README.There is no behaviour change unless the new keys are set.
Test plan
cargo fmt --all— cleancargo clippy -p input-emulation --no-default-features --all-targets -- -D warnings— cleancargo check --no-default-features— clean (macOS)cargo fmt/clippy/test --workspace --all-targets --all-featureson Linux + the Windows emulation backend. I could not build
--all-featureslocally: the gtk frontend pulls in libadwaita, which does not link on my
macOS/nix toolchain, so the Linux backends and the Windows path are only
compile-checked by mirroring the macOS change.