Skip to content

Port the Windows build: complete the hotkey surface, real pill controls - #1

Merged
nitrimandylis merged 9 commits into
nitrimandylis:mainfrom
skibkitty:port/windows
Sep 12, 2026
Merged

nitrimandylis merged 9 commits into
nitrimandylis:mainfrom
skibkitty:port/windows

Conversation

@skibkitty

Copy link
Copy Markdown

What

The Windows platform layer (src-tauri/src/win.rs, cfg(target_os = "windows")) has never compiled — it was written on macOS and was missing the symbols lib.rs calls via hotkey::. This PR makes the Windows build compile, matching the macOS surface.

This is the README-described "Windows built but untested" state (see CHANGELOG-FORK.md: "the Windows layer in src-tauri/src/win.rs has not been updated and will need the same functions added before it compiles again"). It compiles now; runtime correctness on a real Windows machine is the follow-up.

Changes

src-tauri/src/win.rs — added the missing symbol surface, mirroring the macOS hotkey.rs::imp implementations:

  • models_dir() / model_path() — language-aware model selection: honours Settings.whisper_model first, otherwise picks the best installed model for the configured language (.en variants for English, multilingual ggml-*.bin otherwise) — previously non-English users silently got an English-only model
  • read_openai_key() / read_anthropic_key() — env var or OS keyring (same read_key helper as macOS)
  • rebuild_asrpub (was private, not re-exported)
  • ui_start / ui_stop / ui_cancel / trigger_hands_freereal handlers wired to the keyboard-hook thread's on_ptt_down/on_ptt_up/abort path. The pill's Start / ■ / ✕ / hands-free hotkey now actually do something instead of being empty stubs
  • LAST_BAR static + last_bar() recorded in emit_bar, so sync_pill_visibility can restore the right pill state

src-tauri/src/hotkey.rs — the Windows re-export now matches the macOS export list exactly (previously it exported dead stop_dictation/cancel_dictation stubs and missed last_bar, models_dir, model_path, the two key reads, rebuild_asr, and the pill controls).

Cargo.lock — synced the workspace crates to the 1.0.0 version bump already on main (ed09182), which the lockfile hadn't picked up.

Verification

  • cargo check --target x86_64-pc-windows-gnu -j1 in src-tauri/ — passes (first compile of this module)
  • cargo check --workspace -j1 (Linux) — passes
  • cargo test --workspace -j1 — all pass

Memory note: this machine OOM-crashes on parallel cargo builds. All checks ran with CARGO_BUILD_JOBS=1 and CMAKE_BUILD_PARALLEL_LEVEL=1 — the latter serializes the whisper.cpp/llama.cpp cmake build scripts, which parallel-spawn cc1plus regardless of cargo's job count.

Follow-up (not in this PR)

  • Windows CI job (build + sidecar stage)
  • Runtime validation on a real Windows machine: the tray icon .icon_as_template(true) call (lib.rs:1327) is macOS-only in Tauri v2 and will need a cfg guard; push-to-talk, paste, pill controls, whisper download/load under %APPDATA%\WhimprFlow

Checked on this machine: local pip/Windows cross-check only. CI is the authoritative Windows gate.

skibkitty and others added 6 commits September 6, 2026 20:48
The Windows layer (cfg(target_os=windows), never compiled until now) was
missing the symbols lib.rs calls via hotkey::. Add them mirroring the
macOS surface:

- models_dir/model_path with language-aware model selection (honours
  Settings.whisper_model, otherwise picks .en variants for English and
  multilingual ggml-*.bin otherwise)
- read_openai_key/read_anthropic_key via env var or keyring
- real ui_start/ui_stop/ui_cancel/trigger_hands_free wired to the hook
  thread's on_ptt_* handlers (no more empty stubs)
- LAST_BAR + last_bar remembered in emit_bar
- make rebuild_asr pub
- fix the Windows re-export to match the macOS export list

Verified: cargo check --target x86_64-pc-windows-gnu -j1 (in src-tauri),
cargo check --workspace -j1, cargo test --workspace -j1. The Cargo.lock
is synced to the 1.0.0 version bump from ed09182.
Windows CI modeled on build-macos.yml: builds the whimpr-llm-worker
sidecar for x86_64-pc-windows-msvc, stages it into src-tauri/binaries,
runs cargo check/test across the workspace, and builds the frontend so
the Tauri app bundles. Runs on pull_request to gate the Windows port.
icon_as_template(true) is macOS-only in Tauri v2 and would panic at
startup on Windows. Apply the template only on macOS; other platforms
just set the full-color icon. Runtime fix identified in Phase 3.
The macOS-only PushToTalkKey concept (Fn / Globe, Right Command, Right
Option) leaked into the Windows settings UI: the default is 'fn', but
the Windows keyboard hook only implements Right Control (PTT_VK). The
setting was ignored on Windows, so the app advertised a key that did
nothing while only Right Control worked.

Normalize push_to_talk_key to RightControl on load and on save so every
reader (settings pane, onboarding, FlowBar, history) shows the key the
hook actually responds to. Fix found during the Phase 3 Windows runtime
pass (issue #7).
@skibkitty
skibkitty marked this pull request as ready for review September 7, 2026 22:52
@nitrimandylis
nitrimandylis merged commit 796b9c0 into nitrimandylis:main Sep 12, 2026
1 check passed
@nitrimandylis

Copy link
Copy Markdown
Owner

Thanks for this — merged with one small fix on top (the default PTT fallback in FlowBar was hardcoded to right_control, which flashed "Right ⌃" on macOS before settings loaded; made it platform-aware).

Solid work all around. The normalize_ptt guard, the language-aware model fallback, and the acceleratorFromEvent Super/CmdOrCtrl split were all well thought through.

@skibkitty

Copy link
Copy Markdown
Author

preem, glad to see it!

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.

2 participants