electron/main.js

Desktop application shell that starts the backend, opens the UI window, and manages native lifecycle behaviors.

CategoryElectron
Sourceelectron/main.js

What it does

Desktop application shell that starts the backend, opens the UI window, and manages native lifecycle behaviors.

Key responsibilities

  • Ensures a single app instance and restores the existing window on second launch.
  • Spawns and monitors the Python backend, including crash recovery and exponential restart backoff.
  • Implements backend health checks and automatic recovery when the backend becomes unresponsive.
  • Creates a frameless BrowserWindow with preload scripts and loads developer or production frontend content.
  • Manages tray menu, window events, and native integrations such as notifications, clipboard, and location.

Related files

Explore other files in the Electron category.