Open files and folders with the app via OS file associations#15
Merged
Conversation
Register .md/.markdown/.mdx associations so DocsReader appears in Finder's Open With menu and can be set as the default handler. Opened targets route into the app: a folder becomes a workspace root, and a file resolves to its enclosing workspace (or its parent folder as an ad-hoc root) and opens in the active pane. macOS delivers opens through RunEvent::Opened for both cold and warm starts; Windows and Linux deliver them as argv via the single-instance plugin, which also folds a second launch into the running window. A buffer on the Rust side holds paths captured before the frontend mounts so cold-start opens are not lost.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds OS-level "Open With DocsReader" for markdown files and folders:
.md/.markdown/.mdxin Finder, or right-click > Open With > DocsReaderWorks whether the app is already running (warm) or is launched by the open (cold).
How
bundle.fileAssociationsintauri.conf.jsonregisters.md/.markdown/.mdx, generating the macOSCFBundleDocumentTypes/ UTI declarations.RunEvent::Opened { urls }. A buffer in Rust state (OpenedPaths) holds paths captured before the webview mounts, drained by thetake_opened_pathscommand on cold start; warm opens are delivered via theopen-pathevent.tauri-plugin-single-instancefolds a second launch into the running window and forwards the file path fromargv.useOpenWithlistens foropen-path(and drains the cold-start buffer), then routes each target - folder toaddRoot, file to its resolved root +openInActivePane. Handling is serialized so batched opens don't race on the shared root list.Validation
Local, mirroring CI:
tsc --noEmit, 116 frontend tests,vite build,cargo fmt --check,cargo clippy --workspace --all-targets -D warnings,cargo test --workspace- all green.The OS-level LaunchServices registration and Apple Event delivery can only be exercised from a bundled/notarized build, so that path gets its real end-to-end test from the release artifact.