Skip to content

Press duration per key (fixed time or hold while pressed) - #6

Merged
thnow merged 1 commit into
mainfrom
press-duration
Nov 25, 2026
Merged

thnow merged 1 commit into
mainfrom
press-duration

Conversation

@thnow

@thnow thnow commented Nov 25, 2026

Copy link
Copy Markdown
Owner

What

Keys can now hold their shortcut longer than a short tap – useful in games:

  • Fixed time: hold = 0.8 (seconds, up to 60) – pressed for 0.8 s however briefly the deck key is touched.
  • Hold while pressed: hold_while_pressed = true – the shortcut stays down as long as the deck key is held (sprint, aim, push to talk …).

Editor: new Key press setting in the key panel. Keys with a non-default press show a small corner badge (0.8 s / hold). Texts are translated; the decimal separator comes from the catalog (German: 0,8 s).

How

  • KeySender base class now owns pressing/releasing; backends only implement resolve and _emit (optionally _sequence, _ready). Keys are reference counted, so several deck keys can hold keys at the same time and a shared modifier (e.g. Shift) stays down until the last key lets go. release_all() on pause and close.
  • Ported all three backends: uinput (Linux), Quartz (macOS – every event still carries the modifier flags held right now, now including those held by other deck keys) and SendInput (Windows – layout resolved once per shortcut as before).
  • DeckController: short taps stay in the ordered queue; fixed holds run in their own thread so they don't block other keys; hold-while-pressed is released on the deck key's up event, even after a profile switch, and on pause.
  • Invalid hold values are reported like invalid shortcuts (profile + key in the message, red key in the editor).

Tested

  • Linux (Ubuntu 26.04): ruff, full test suite (84 passed), i18n.py check. New tests cover tap order, fixed hold duration, press/release, shared modifiers, release_all, config validation, the badge in EN/DE, and – through DeckController with a fake device – hold-while-pressed, a fixed hold not blocking other keys, and pause releasing held keys. Editor checked offscreen in English and German (set mode, save, reload).
  • Not tested on hardware: actual key events on the Stream Deck (I can't observe the virtual keyboard's output here without sending keys into the focused window), and the macOS and Windows backends – their port is straightforward but only exercised through CI. Worth a quick check on the Mac and on Windows: a fixed hold, a held Shift, and a ⌘/Ctrl shortcut while another key is held.

🤖 Generated with Claude Code

Keys can hold their shortcut for a fixed time (`hold`, seconds) or as long
as the deck key is pressed (`hold_while_pressed`), e.g. for games.

- KeySender: press/release logic moved into the base class. Keys are
  reference counted, so several deck keys can hold keys at once (a shared
  modifier stays down until the last one lets go); release_all() on pause
  and close. Backends now implement resolve/_emit (+ _sequence, _ready);
  ported uinput (Linux), Quartz (macOS: every event carries the modifiers
  held right now) and SendInput (Windows).
- DeckController: fixed holds run in their own thread, so they don't block
  other keys; hold-while-pressed follows the deck key's up event.
- Editor: "Key press" setting; keys show a small corner badge
  ("0.8 s" / "hold"), translated (German catalog updated).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thnow
thnow merged commit 0ecc974 into main Nov 25, 2026
5 checks passed
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