"Each window is its own little browser tab. They don't share a single line of JavaScript — so the truth has to live somewhere they both can reach: the core."
Separate Webviews, Separate Worlds
Every window is an independent webview with its own JavaScript context. Your React state in the main window does not exist in the settings window — they're as isolated as two browser tabs. This surprises people: opening a second window doesn't 'share' your store. If two windows must agree on data, that data belongs in the Rust core (managed state), and each window reads it through commands. The core is the single source of truth; windows are views onto it.
Talking Between Windows
Windows coordinate through the core. To push something to a specific window, use emit_to("label", …); to broadcast to all, emit. A common flow: the settings window saves a preference via a command (updating managed state), then the core emits a settings-changed event that the main window listens for and reacts to. No window calls another directly — they all go through the core, which keeps the data consistent.
Lifecycle: show, hide, close
Windows have a lifecycle you control: show(), hide(), close(), plus events you can listen to like close-requested (to confirm before closing) or focus changes. Hiding instead of closing keeps a window's webview alive (fast to reopen, state preserved); closing destroys it (frees resources, fresh state next time). Choose based on whether reopening should be instant or clean.