Describe the bug
On macOS, double-clicking a markdown file can silently do nothing — no window, no error — when a second copy of Markpad ends up launching while another copy is already running. The file-open event is lost entirely.
This happens whenever two copies of the app exist (e.g. the user once ran Markpad straight from the DMG or ~/Downloads, and also has a copy in /Applications) — or in any dev/test setup running a locally built bundle alongside the installed one.
Mechanism
macOS delivers Finder file-opens as an Apple Event (odoc) — the file path is never in argv. The sequence that eats it:
- LaunchServices resolves the
.md handler to a specific bundle path (say /Applications/Markpad.app). The running copy has a different bundle path, so LS considers the handler "not running" and launches a new process, addressing the Apple Event to it.
- The new process starts and
tauri-plugin-single-instance runs immediately: it detects the primary instance (same bundle identifier), forwards its argv — which contains no file path on macOS — and exits.
- The Apple Event arrives for a process that is already dead. It is dropped; the primary instance only gets an argv-only ping (it focuses the window, opens nothing).
Single Instance Args: ["/Applications/Markpad.app/Contents/MacOS/Markpad"] in the logs confirms the forwarded argv carries no file.
To Reproduce
- Have two copies of Markpad (e.g. one in
/Applications, one anywhere else) sharing the bundle id.
- Launch copy B and leave it running.
- Double-click any
.md file in Finder (LS targets copy A).
- Copy A flashes into existence, forwards, exits; the file never opens anywhere.
Expected behavior
The file opens in the running instance (or the second instance keeps ownership long enough to receive and forward the actual file paths).
Suggested fix
In the single-instance handling on macOS, don't exit before the open-documents Apple Event has been received: capture the opened paths (Tauri's RunEvent::Opened) and forward those to the primary instance instead of raw argv — or delay the exit until the first event-loop turn so Opened can fire. (Upstream, this is arguably a tauri-plugin-single-instance limitation: argv-forwarding is complete on Windows/Linux but loses Finder opens on macOS.)
Device
- OS: macOS (Darwin 25.x)
- App Version: v2.6.11 (also reproduced against current master builds)
🤖 Generated with Claude Code
Describe the bug
On macOS, double-clicking a markdown file can silently do nothing — no window, no error — when a second copy of Markpad ends up launching while another copy is already running. The file-open event is lost entirely.
This happens whenever two copies of the app exist (e.g. the user once ran Markpad straight from the DMG or
~/Downloads, and also has a copy in/Applications) — or in any dev/test setup running a locally built bundle alongside the installed one.Mechanism
macOS delivers Finder file-opens as an Apple Event (
odoc) — the file path is never inargv. The sequence that eats it:.mdhandler to a specific bundle path (say/Applications/Markpad.app). The running copy has a different bundle path, so LS considers the handler "not running" and launches a new process, addressing the Apple Event to it.tauri-plugin-single-instanceruns immediately: it detects the primary instance (same bundle identifier), forwards its argv — which contains no file path on macOS — and exits.Single Instance Args: ["/Applications/Markpad.app/Contents/MacOS/Markpad"]in the logs confirms the forwarded argv carries no file.To Reproduce
/Applications, one anywhere else) sharing the bundle id..mdfile in Finder (LS targets copy A).Expected behavior
The file opens in the running instance (or the second instance keeps ownership long enough to receive and forward the actual file paths).
Suggested fix
In the single-instance handling on macOS, don't exit before the open-documents Apple Event has been received: capture the opened paths (Tauri's
RunEvent::Opened) and forward those to the primary instance instead of raw argv — or delay the exit until the first event-loop turn soOpenedcan fire. (Upstream, this is arguably atauri-plugin-single-instancelimitation: argv-forwarding is complete on Windows/Linux but loses Finder opens on macOS.)Device
🤖 Generated with Claude Code