Skip to content

fix(shortcuts): scope OS-level key blocking to push-to-talk triggers#12

Merged
Melvynx merged 3 commits into
mainfrom
fix/scoped-keyboard-blocking
Jun 18, 2026
Merged

fix(shortcuts): scope OS-level key blocking to push-to-talk triggers#12
Melvynx merged 3 commits into
mainfrom
fix/scoped-keyboard-blocking

Conversation

@Melvynx

@Melvynx Melvynx commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Problème

Klack ne détecte plus les frappes et l'enregistreur de raccourcis macOS ne voit que les modificateurs (⌘/⌥/⌃) — symptôme classique d'une app qui hijacke le clavier.

Diagnostic (via CGGetEventTapList) : Parler était le seul tap tiers actif (mode Default, inséré en tête au niveau Session) captant les keyDown. La crate handy-keys en mode bloquant consomme (retourne NULL) toute frappe matchant un raccourci enregistré — pour toutes les apps en aval. Or Parler enregistrait tous ses bindings (transcribe, pause, cancel/escape, show_history, copy_latest_history, action 1-9…) comme bloquants. Un binding trop large ou un tap dégradé sous charge avale alors des touches à l'échelle système.

Fix

Deux managers dans le thread de gestion :

  • Bloquant : uniquement les déclencheurs push-to-talk (is_transcribe_binding) — ils doivent être supprimés (sinon maintenir option+space taperait des espaces).
  • Passif (non bloquant) : tout le reste. Détecté mais jamais consommé.

Résultat : au pire seuls les combos transcribe configurés sont bloqués ; Escape, F6, history, et les touches chiffres d'action ne sont plus avalés globalement.

Inclut aussi le garde-fou de suppression pendant l'enregistrement (is_capturing / MAX_RECORDING_DURATION).

Test

  • cargo check
  • Vérifié que quitter Parler retirait le tap actif et libérait le clavier (tap count 17→16).

Pour mettre à jour en local

git checkout fix/scoped-keyboard-blocking && git pull
pnpm tauri build   # ou ton flow habituel

Melvynx added 3 commits June 18, 2026 12:20
Dev builds (productName ending in "Dev") now use the window title
"Parler Dev" so they can't be confused with a production Parler window.
Parler used a single blocking handy-keys HotkeyManager and registered
EVERY binding (transcribe, pause, cancel/escape, show_history,
copy_latest_history, action digits, …) into it. handy-keys' blocking
manager installs an active CGEventTap (Default mode, head-inserted at
the Session level) and consumes any keystroke matching a registered
combo — for ALL applications downstream.

The result: a single misbehaving or overly-broad binding could swallow
keys system-wide, which breaks keystroke monitoring for other apps
(Klack stops detecting keys, the macOS shortcut recorder only sees
modifier keys, etc.) — i.e. Parler appears to "hijack" the keyboard.

Fix: run two managers in the manager thread.
- A blocking manager that ONLY handles push-to-talk transcribe triggers
  (is_transcribe_binding), which genuinely need suppression so holding
  e.g. option+space doesn't type spaces.
- A passive (non-blocking) manager for every other binding. It detects
  the shortcut but can never consume a keystroke.

So at most the configured transcribe trigger combos are ever blocked;
cancel/escape, pause/F6, history and action-digit keys are no longer
swallowed globally.

Also includes the in-progress recording-capture suppression safety net
(is_capturing / MAX_RECORDING_DURATION) that auto-expires suppression
if the frontend never calls stop_recording.
@Melvynx Melvynx merged commit 1aaa38b into main Jun 18, 2026
2 of 4 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