Skip to content

feat: add minimize-to-tray option for background running#48

Open
NSIETeam wants to merge 3 commits into
OrionStarAI:opensourcefrom
NSIETeam:feat/minimize-to-tray
Open

feat: add minimize-to-tray option for background running#48
NSIETeam wants to merge 3 commits into
OrionStarAI:opensourcefrom
NSIETeam:feat/minimize-to-tray

Conversation

@NSIETeam

Copy link
Copy Markdown

What

Adds a "Keep running in background" option to Settings that minimizes the app to the system tray instead of quitting when the window is closed.

How it works

  1. User enables "Keep running in background" in Settings > General
  2. When user closes the window (X button), the window hides to system tray instead of quitting
  3. AI sessions, Feishu gateway, and background tasks continue running
  4. System tray icon appears with context menu:
    • Show Easy Code — restore the window
    • Quit — fully quit the app
  5. Clicking the tray icon toggles window visibility

Files Changed

File Change
shared/ipc.ts Add minimizeToTray field to DesktopUserSettings
main/userSettings.ts Read/write minimizeToTray in settings.json
main/index.ts Tray creation, window close interception, window-all-closed guard
renderer/SettingsDialog.tsx Checkbox toggle in General settings tab

Implementation Details

  • Tray icon: Uses the app icon resized to 16x16
  • Close interception: mainWindow.on('close') checks minimizeToTray setting; if enabled and not quitting, calls preventDefault() + hide()
  • window-all-closed guard: Prevents app.quit() when in tray mode
  • Quit path: isQuitting flag set by tray "Quit" menu and before-quit handler ensures clean shutdown
  • Setting persistence: Stored in ~/.easycode-user/settings.json (shared with CLI)

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