Originally created by: Akarsh-Hegde
Summary
- Add a Tauri
RunEvent::Reopen handler so activating Meridian externally (Spotlight, dock click, open -a Meridian) actually opens something instead of being a silent no-op while the tray is running.
- Onboarded → dashboard window. Not onboarded → setup wizard (resumes a partial onboard).
- Cold-start behavior unchanged: the setup hook still auto-opens the wizard on first launch.
Why
The tray runs as ActivationPolicy::Accessory — no dock icon most of the time — and Tauri drops the reopen event on the floor without a handler. Users hitting ⌘Space → "Meridian" ⏎ saw nothing happen.
Test plan
- [ ] Fresh
~/.meridian (no onboarded file) → Spotlight-launch Meridian on an already-running tray → setup wizard opens.
- [ ] With
onboarded present → Spotlight-launch Meridian → dashboard window opens (or focuses if already open).
- [ ] Dock click while dashboard is open → dashboard focuses.
- [ ]
cargo check + cargo clippy clean on tray/src-tauri/.
🤖 Generated with Claude Code
Originally posted by: coderabbitai[bot]
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests - [ ] Commit unit tests in branch `feat/reopen-opens-dashboard`Comment
@coderabbitai helpto get the list of available commands.Originally posted by: adityaharishch
Reviewed the diff (
tray/src-tauri/src/lib.rs,tray/src-tauri/src/tray.rs). Overall this is a small, well-scoped change and it's structurally sound — no blockers.What checks out:
RunEvent::Reopen(macOSapplicationShouldHandleReopen) is fired only by dock-icon click /open -a/ Spotlight re-activation — it is a distinct event from the tray status-item click (TrayIconEvent), so there's no risk of this firing when the user clicks the menu-bar icon and popping the dashboard/wizard over the popover.tray::open_native_dashboard(tray.rs:87-124) andtray::open_wizard_window(tray.rs:163-178) alreadyget_webview_window(...)+show()/set_focus()before building a new one, so the newReopenhandler can't spawn a duplicate dashboard/setup window even on repeat activations.open_native_dashboardwas widened fromfntopub(crate) fn(tray.rs:87) specifically to make this possible, which is the right move (single source of truth, per the module's own doc comment about the tray-menu path needing "the same fix").Minor, non-blocking:
lib.rs:414(Reopenhandler) reads~/.meridian/onboardedinline viastd::env::var("HOME"), which is now the third copy of this exact check —commands/setup.rs:38-40(is_first_run) and the existing first-launch auto-open atlib.rs:407-418both do the same thing. Not introduced by this PR (the pattern already existed pre-change), but this would've been a good spot to factor into a small shared helper (e.g.fn is_onboarded() -> bool) since the PR is already touching this exact logic. Not worth blocking on.Reopenmatch ignoreshas_visible_windows(destructured as{ .. }). Harmless given the reuse behavior in the openers above (a secondReopenwhile the dashboard is already frontmost just re-shows/re-focuses it), but ifhas_visible_windowsis ever relevant to future logic here it's currently unused — worth a comment noting it's intentionally ignored, for the next person who touches this..context(...)needed since there are no fallible calls here beyond the pre-existingunwrap_or_default()onHOME, which matches existing precedent elsewhere in the file (install.rs) — fine.Overall: looks correct and safe to merge. The event choice, window-reuse guarantees, and onboarding-vs-dashboard routing all check out.
Originally posted by: Akarsh-Hegde
Follow-up commit adds test coverage and fixes a compile break:
RunEvent::Reopenis a#[cfg(target_os = "macos")]enum variant — it doesn't exist on other targets. The un-gatedif letwould fail to compile onubuntu-latest, where CI builds the whole workspace (the tray is a member). The macOS-only pre-push hook can't catch this. The arm is now#[cfg(target_os = "macos")]-gated.is_onboarded(home)+reopen_target(onboarded) -> ReopenTarget(platform-independent, so the tests run in Linux CI) and added coverage for both routing arms + the onboarded-marker filesystem check.The OS-integration half (macOS actually delivering the reopen event on Spotlight/dock activation) still needs a manual check — there's no WebDriver path for a menu-bar app on macOS.
Originally posted by: Akarsh-Hegde
Thanks for the thorough pass — both minor notes addressed:
~/.meridian/onboardedcheck → factored out in a follow-up (4560f56d): the reopen handler now calls a sharedis_onboarded(home)helper (with a companionreopen_target(onboarded) -> ReopenTarget), both unit-tested.commands::setup::is_first_runis its documented inverse. (That follow-up also fixed a real one:RunEvent::Reopenis#[cfg(target_os = "macos")], so the un-gatedif letwould fail to compile on the Linux CI runner — now cfg-gated. Detail in the earlier comment.)has_visible_windowsignored → added a comment (31064f71) explaining it's intentional: both openers reuse an existing window viaget_webview_window+ show/focus, so a reopen just re-focuses; the flag would only matter for distinct visible-vs-minimised behaviour we don't want.Nothing else outstanding on your review.
Ticket changed by: Akarsh-Hegde