ReviewOS

craft-native/craft

No NSApplicationDelegate: dock-icon reopen is dead, closing the last window strands the process

#63
Closed glennmichael123 opened this 11 days ago ·
11 days ago

Craft never installs an NSApplicationDelegate — NSApplication is only touched for one-off calls (bridge_app.zig:54, :70), and the only delegate wired anywhere is the per-window NSWindowDelegate for events (macos_window_events.zig:44). Repo-wide grep finds neither applicationShouldHandleReopen nor applicationShouldTerminateAfterLastWindowClosed.

Two user-visible consequences:

  1. Clicking the dock icon after the window is closed does nothing — no reopen path exists.
  2. With no delegate, AppKit's default for terminate-after-last-window is NO: closing the last window leaves the process running with no window and no way to get one back. Combined with (1), the only recovery is force-quit.

Ask: install an app delegate that (a) implements applicationShouldHandleReopen:hasVisibleWindows: to re-show the window, and (b) implements applicationShouldTerminateAfterLastWindowClosed: returning YES by default, with a craft.json/flag opt-out for tray/menubar-only apps that legitimately outlive their window. The delegate also becomes the natural home for future lifecycle work (deep-link application:openURLs:, notification response delegates).

🤖 Generated with Claude Code

Sign in to comment on this issue.