Skip to content

feat(gui): register .wind desktop file association (#148) - #321

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/wind-file-association
Jun 30, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/wind-file-association

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Closes #148.

Double-clicking a .wind file now opens it in FiberPath.

Approach

  • Declaration — bundle.fileAssociations in tauri.conf.json registers the .wind extension (media type application/vnd.fiberpath.wind+json, role Editor). The Tauri bundler turns this into the per-platform metadata: registry entries (Windows nsis/msi), a .desktop MimeType + MIME XML (Linux deb/appimage), and CFBundleDocumentTypes (macOS app/dmg).
  • Receiving the path — unified across the two OS delivery channels:
    • Windows / Linux deliver the file as a command-line argument. Cold start reads std::env::args; a second launch is forwarded by tauri-plugin-single-instance (registered first), which also focuses the existing window instead of spawning a duplicate.
    • macOS delivers it as an Apple Event surfaced as RunEvent::Opened { urls }.
  • One open, one channel — a frontend_ready flag in managed state means a path is stashed until the frontend drains it on mount (take_opened_file) and emitted (open-wind-file) thereafter. The frontend subscribes before draining, so an open is never loaded twice or dropped.
  • Loading — both channels route through the existing dirty-checked openRecent flow (JSON parse + schema validation already there) and land in the Prepare workspace. The arg-parsing logic lives in file_association.rs with unit tests.

Tests / checks

  • cargo test (7 pass, incl. 5 new wind_path_from_args cases) · clippy -D warnings clean · cargo fmt --check clean
  • vitest 324 pass (2 new App-shell tests: open-on-launch + no-op when nothing handed over) · tsc + svelte-check clean · stylelint + CSS-var guard clean · bundle budget passed
  • macOS RunEvent::Opened arm is cfg-gated (doesn't compile on the Linux CI host); verified by inspection against the installed tauri 2.11.3 / url 2.5 / tauri-plugin-single-instance 2.4 sources (RunEvent::Opened { urls: Vec<url::Url> }, Url::to_file_path() -> Result<PathBuf, ()>, callback FnMut(&AppHandle, Vec<String>, String)).

Not covered here (manual QA)

OS-level registration only exists after installing a packaged build, so install-and-double-click can't run in CI. The per-platform double-click matrix belongs on the manual validation checklist (#149). AppImage association is best-effort — a portable AppImage isn't system-registered unless integrated; the .deb registers normally.

Behaviour change

The single-instance guard means a second launch now focuses the running window rather than opening a second instance — the correct UX for a single-document desktop app, and what makes warm-open work on Windows/Linux.

Double-clicking a `.wind` file now opens it in FiberPath. Declare the
association via `bundle.fileAssociations` so the Tauri bundler writes the
per-platform metadata (registry on Windows, `.desktop`/MIME on Linux,
`CFBundleDocumentTypes` on macOS).

The launch path is received differently per platform and unified into one
delivery: Windows/Linux pass it as a command-line argument (read from
`std::env::args` on cold start, forwarded by the single-instance plugin on a
second launch); macOS delivers it as an Apple Event via `RunEvent::Opened`. A
`frontend_ready` flag routes each open through exactly one channel — stashed for
the frontend to drain on a cold start, emitted as `open-wind-file` once it is
listening — so a file is never loaded twice or dropped. The single-instance
guard also focuses the existing window instead of spawning a duplicate.

The frontend reuses the existing dirty-checked `openRecent` load path and lands
in the Prepare workspace. Argument parsing is isolated in `file_association.rs`
with unit tests; OS-level registration only takes effect in a packaged build
(AppImage is best-effort), so the double-click matrix is left to manual QA.
@CameronBrooks11
CameronBrooks11 merged commit b293179 into main Jun 30, 2026
18 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/wind-file-association branch June 30, 2026 01:07
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.

Desktop integration: register .wind file association to open FiberPath

1 participant