Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:AI QL Tuui Electron Window Lifecycle

From Leeroopedia
Knowledge Sources
Domains Electron, Window_Management, App_Lifecycle
Last Updated 2026-10-24 00:00 GMT

Overview

A lifecycle management pattern that governs the creation, configuration, display, and teardown of Electron BrowserWindow instances across the splash, main, and error stages of a desktop application.

Description

The Electron Window Lifecycle defines the stages an application goes through to present its UI: a lightweight splash window shown immediately on app.ready, the main window assembled with platform-specific chrome, tray integration, and IPC/MCP bootstrap, and a fallback error window shown when the renderer process crashes. It addresses the problem of coordinating multiple windows with different roles and ensuring the main window is fully wired (devtools, tray, IPC handlers, MCP clients) before the user interacts with it. In the broader Electron ecosystem, this lifecycle ensures a smooth perceived startup, graceful crash recovery, and clean shutdown.

Usage

Use this principle when designing an Electron desktop application that needs a splash screen for perceived performance, a main window with system-tray integration and IPC bootstrap, and an error fallback window for renderer crashes.

Theoretical Basis

The lifecycle follows a staged window model:

  1. Splash — A minimal frameless transparent window loaded instantly to give immediate visual feedback
  2. Main — The primary window assembled with platform-specific options (hidden title bar, overlay), tray wiring, IPC initialization, and MCP handler registration
  3. Error — A fallback window loaded on render-process-gone that hides/destroys the main window and shows a crash route
  4. Exit — Hide, destroy, and terminate the app cleanly

Each stage is a prerequisite for the next in the startup path; the error stage is a branch triggered by crash events.

app.ready → Splash Window → Main Window (tray + IPC + MCP) → User Session
                                    ↓ (render-process-gone)
                              Error Window → Exit

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment