Skip to content

feat(windows): edit-selection via Ctrl+C [CI staging] - #2

Open
kstorm12 wants to merge 3 commits into
mainfrom
feat/windows-edit-selection
Open

kstorm12 wants to merge 3 commits into
mainfrom
feat/windows-edit-selection

Conversation

@kstorm12

Copy link
Copy Markdown
Owner

Staging PR so the Windows workflow builds this branch. Depends on fix/windows-configured-hotkeys (which makes the edit-selection hotkey register at all).

kstorm12 and others added 3 commits July 25, 2026 20:09
On Windows/Linux the hotkey listener in `input/hotkeys.rs` is a no-op stub
(the real implementation is a macOS CGEventTap), so the binding the Settings
UI writes was never read. Windows instead registered a hardcoded
Ctrl+Alt+Space, which meant the hotkey UI was inert and the actual trigger
was unchangeable.

That combination is also a popular one — Claude desktop's default, among
others — and Windows `RegisterHotKey` is first-come-first-served across
processes. When another app already owns it, registration failed, and since
the configured binding did nothing and there is no in-app record button,
there was no way at all to start dictation. The failure surfaced only as a
`tracing::warn!`, so the app looked healthy while doing nothing.

- `trigger::sync_shortcuts` now rebuilds every global shortcut from the four
  configured bindings. It is idempotent (unregisters first), runs at pipeline
  start, and re-runs after every rebind, so Settings works on Windows.
- Registration problems are returned as `HotkeyProblem { action, message }`,
  stored on `AppState`, and rendered by `HotkeyRebinder` next to the shortcut
  that caused them — a taken or unregistrable combination is now visible.
- `RegisterHotKey` cannot express a bare modifier, so the shipped macOS
  default (Right Control alone) is reported as unsupported rather than
  silently ignored. Left/right modifier sides are folded, as Windows has no
  notion of them.
- Add `tauri-plugin-single-instance`: a second launch previously started a
  second process that lost the hotkey race to the first and ended up equally
  dead. Focus the existing window instead.
- Fix `log_dir()`, which returned the macOS `~/Library/Logs` path on every
  platform, to use the local data dir off macOS.

Fixes desduvauchelle/tucky-landing#2

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two Echo Scribe actions bound to the same combination is legal on macOS (the
CGEventTap just sees the same keys satisfy two bindings) but RegisterHotKey
rejects the second registration. That surfaced as the generic "another
application is probably already using that combination" message, sending the
user hunting for a conflict that is actually between two of our own hotkeys.

Observed on a real Windows run: voice-at-cursor and log-capture were both
Shift+T, and the failure carried the SAME HotKey id as the successful one.

Detect the collision before asking the OS and report which action holds the
combination. Modifier order is now canonicalised in shortcut_parts so two
bindings requiring the same modifiers compare equal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`focus::capture_selection` returned None off macOS, so the edit-selection
hotkey registered and then silently did nothing — the most confusing kind of
half-working feature.

macOS tries AXSelectedText first and falls back to a synthetic Cmd+C plus a
clipboard-delta read. That fallback is entirely platform-neutral apart from the
chord synthesis, so rather than duplicate it, `capture_selection_via_copy` is
now compiled on every platform and only `synthesize_cmd_c` is cfg-split —
mirroring how `synthesize_cmd_v` already had an enigo path for Windows.

Windows therefore reports SelectionMethod::Copy, which means the apply path
skips the AX write-back (unavailable anyway, `replace_selected_text` returns
-1) and goes through paste_at_cursor's Ctrl+V, replacing the live selection.

Co-Authored-By: Claude Opus 5 (1M context) <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.

1 participant