Skip to content

Desktop v0.1.5: fix blank second launch when authed#324

Merged
ericflo merged 1 commit intomainfrom
desktop-v0.1.5-reopen-fix
Apr 20, 2026
Merged

Desktop v0.1.5: fix blank second launch when authed#324
ericflo merged 1 commit intomainfrom
desktop-v0.1.5-reopen-fix

Conversation

@ericflo
Copy link
Copy Markdown
Owner

@ericflo ericflo commented Apr 20, 2026

Problem

After signing in with v0.1.4, closing and re-opening the app left users with no visible window and a tray that felt dead. "It's like it's busted if you're authed or something."

Root cause

The onboarding wizard saves auto_start: true on finish (ui/index.html:940). Combined with a saved worker_secret, this matched the intentional "silent tray-only launch" branch in main.rs:

if auto_start {
    // spawn worker, do NOT show window
} else if let Some(window) = app.get_webview_window("main") {
    let _ = window.show();
    // ...
}

So every wizard-completed user became a silent-tray user on the next launch. Compounding it:

  • WindowEvent::CloseRequested was unhandled, so the red-X on macOS could destroy the window (not just hide it)
  • RunEvent::Reopen was unhandled, so clicking the Dock icon on an already-running instance did nothing visible — the canonical macOS way to come back to a hidden-window app

Fix

Decouple worker auto-start from window visibility:

  • Always show the window on launch. auto_start still starts the worker daemon automatically, but doesn't hide the UI
  • WindowEvent::CloseRequested → hide-to-tray. The window is hidden and the close is prevented, so Dock/tray reopen lands on the same session
  • RunEvent::Reopen handler (macOS only) re-shows + focuses the main window when the user clicks the Dock icon or re-launches the app while a copy is running
  • Quit stays reachable via the tray menu and Cmd+Q (RunEvent::ExitRequested)

Bumps desktop crate + tauri.conf.json to 0.1.5. Refreshed Cargo.lock and CHANGELOG.md.

Test plan

  • Complete onboarding wizard → worker connects
  • Close the window with red X → window disappears, tray icon stays, app keeps running
  • Click Dock icon → window reappears
  • Quit app, re-launch → window appears with worker auto-starting in the background
  • Tray menu items (Open Dashboard, Settings, Check for Updates, Quit) all work
  • Cmd+Q fully quits the app

Release

Once merged, push desktop-v0.1.5 tag to trigger the signed macOS / Windows / Linux release build.

🤖 Generated with Claude Code

The v0.1.4 onboarding wizard saves `auto_start: true` on finish, which
matched the "silent tray-only launch" condition in main.rs
(`auto_start && !worker_secret.is_empty()`) and suppressed `window.show()`
on every subsequent launch. Returning users got a dead-looking app with
no obvious way back in, especially because the tray icon is easy to miss
in the macOS menu bar and the red-X close button wasn't hiding the window
either.

Decouple the two concerns:

- `auto_start` still starts the worker daemon automatically on launch
- The dashboard window is now always shown on startup
- `WindowEvent::CloseRequested` hides the window instead of destroying
  it, so Dock-click / tray reopen lands on the same session
- `RunEvent::Reopen` (macOS Dock click / relaunch while running) now
  re-shows and focuses the main window — previously this event went
  unhandled, so clicking the Dock did nothing visible

Quit remains reachable via the tray menu and Cmd+Q.

Also:
- Bump desktop crate + tauri.conf.json to 0.1.5
- Refresh Cargo.lock and CHANGELOG.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ericflo ericflo merged commit 90dc6f9 into main Apr 20, 2026
10 of 12 checks passed
@ericflo ericflo deleted the desktop-v0.1.5-reopen-fix branch April 20, 2026 00:58
ericflo added a commit that referenced this pull request Apr 20, 2026
Take RunEvent by reference in handle_run_event and convert the
app.run closure to pass &event. Fixes the macos-latest clippy job
introduced in #324:

  error: this argument is passed by value, but not consumed in the
  function body

On Linux/Windows the non-macos variant uses _event which silenced
the lint there; macOS used the owned form and tripped -D warnings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ericflo added a commit that referenced this pull request Apr 20, 2026
#325)

Take RunEvent by reference in handle_run_event and convert the
app.run closure to pass &event. Fixes the macos-latest clippy job
introduced in #324:

  error: this argument is passed by value, but not consumed in the
  function body

On Linux/Windows the non-macos variant uses _event which silenced
the lint there; macOS used the owned form and tripped -D warnings.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant