Skip to content

feat: add tap-hold-keys action with named key list options#1990

Merged
jtroo merged 6 commits into
jtroo:mainfrom
malpern:feat/tap-hold-keys
Mar 24, 2026
Merged

feat: add tap-hold-keys action with named key list options#1990
jtroo merged 6 commits into
jtroo:mainfrom
malpern:feat/tap-hold-keys

Conversation

@malpern

@malpern malpern commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Describe your changes. Use imperative present tense.

Add tap-hold-keys action with named optional list parameters.

Closes #1985. Follows the design from #1985 (comment):
named list params instead of more positional args.

(tap-hold-keys 200 200 a lctl
  (tap-on-press z v)
  (tap-on-press-release b c)
  (hold-on-press 1 2 3))

All three lists are optional. Unlisted keys use PermissiveHold behavior.

No unicode alias added — happy to add one if you have a preferred name.

Checklist

  • Add documentation to docs/config.adoc
    • Yes
  • Add example and basic docs to cfg_samples/kanata.kbd
    • Yes
  • Update error messages
    • Yes
  • Added tests, or did manual testing
    • Yes

malpern and others added 4 commits March 10, 2026 22:57
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PRESSED_KEYS is a HashSet<OsCode> on macOS (and Windows with
interception_driver), but a HashMap<OsCode, Instant> on Windows
without interception_driver. Iterating the HashMap yields tuples,
so .0 is needed there, but iterating the HashSet yields OsCode
directly, making .0 a compile error on macOS.

Use cfg-conditional release_key calls matching the PRESSED_KEYS
type definitions, consistent with the pattern used elsewhere
(e.g. sim_tests/mod.rs).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a new tap-hold variant `tap-hold-keys` that uses named optional
list parameters instead of positional key lists. This addresses the
usability concern of `tap-hold-release-tap-keys-release` having too
many positional parameters, and adds the ability to trigger hold early
on press for specific keys (closes jtroo#1985).

Syntax:
  (tap-hold-keys <repress-timeout> <hold-timeout> <tap> <hold>
    (tap-on-press <keys...>)
    (tap-on-press-release <keys...>)
    (hold-on-press <keys...>))

All list options are optional. Unlisted keys use PermissiveHold behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@malpern malpern force-pushed the feat/tap-hold-keys branch from 631c6e5 to 1099174 Compare March 22, 2026 06:11

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file.


/// Parse keys from a named option list like `(tap-on-press a b c)`.
/// The first element is the keyword, remaining elements are key names.
fn parse_key_list_from_option(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this check for duplicates keys from the other options and trigger an error on duplicates.

malpern and others added 2 commits March 23, 2026 20:30
- Remove .github/workflows/claude-code-review.yml
- Reject duplicate keys across tap-hold-keys option lists
- Update priority_order test to verify duplicate key error

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	src/tests/sim_tests/tap_hold_tests.rs
@malpern malpern requested a review from jtroo March 24, 2026 04:51
@jtroo jtroo merged commit aed8ec4 into jtroo:main Mar 24, 2026
5 checks passed
malpern added a commit to malpern/kanata that referenced this pull request May 15, 2026
Add `tap-hold-keys` action with named optional list parameters.

Closes jtroo#1985. Follows the design from
jtroo#1985 (comment):
named list params instead of more positional args.

```
(tap-hold-keys 200 200 a lctl
  (tap-on-press z v)
  (tap-on-press-release b c)
  (hold-on-press 1 2 3))
```

All three lists are optional. Unlisted keys use PermissiveHold behavior.

No unicode alias added — happy to add one if you have a preferred name.

---

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

Feature request: combined tap-hold-press + tap-hold-release-tap-keys-release

2 participants