feat: add system tray with quick actions and minimize-to-tray

System tray:
- Always-visible tray icon with context menu
- Quick Scratchpad action from tray (triggers session creation
  via IPC bridge to renderer)
- Running session count in tray tooltip and menu
- Click tray icon to show/focus window
- Quit option in tray menu

Minimize to tray:
- New 'Minimize to tray on close' toggle in Settings > Appearance
- When enabled, closing the window hides to tray instead of
  quitting (configurable per-user, default off)
- macOS: hides dock icon when minimized to tray
- Proper force-quit handling (Cmd+Q on macOS, tray Quit)

Full IPC contract chain:
- minimizeToTray setting in WorkspaceSettings
- setMinimizeToTray channel + ElectronApi method
- Preload bridge, service handler, IPC registration
- Preserved through workspace normalization

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David KayaandCopilot committed 2026-03-29 18:10:38 +02:00
1 parent 8813f9e90a
commit a670817870
10 files changed
+246 -4

No files matched your search

+2
View File
@@ -16,6 +16,7 @@ export const ipcChannels = {
setTheme: 'settings:set-theme',
setTerminalHeight: 'settings:set-terminal-height',
setNotificationsEnabled: 'settings:set-notifications-enabled',
setMinimizeToTray: 'settings:set-minimize-to-tray',
saveMcpServer: 'tooling:mcp:save',
deleteMcpServer: 'tooling:mcp:delete',
saveLspProfile: 'tooling:lsp:save',
@@ -54,4 +55,5 @@ export const ipcChannels = {
workspaceUpdated: 'workspace:updated',
sessionEvent: 'sessions:event',
getQuota: 'sidecar:get-quota',
trayCreateScratchpad: 'tray:create-scratchpad',
} as const;
+2
View File
@@ -195,6 +195,7 @@ export interface ElectronApi {
setTheme(theme: AppearanceTheme): Promise<WorkspaceState>;
setTerminalHeight(input: SetTerminalHeightInput): Promise<WorkspaceState>;
setNotificationsEnabled(enabled: boolean): Promise<WorkspaceState>;
setMinimizeToTray(enabled: boolean): Promise<WorkspaceState>;
describeTerminal(): Promise<TerminalSnapshot | undefined>;
createTerminal(): Promise<TerminalSnapshot>;
restartTerminal(): Promise<TerminalSnapshot>;
@@ -208,6 +209,7 @@ export interface ElectronApi {
onTerminalExit(listener: (info: TerminalExitInfo) => void): () => void;
onWorkspaceUpdated(listener: (workspace: WorkspaceState) => void): () => void;
onSessionEvent(listener: (event: SessionEventRecord) => void): () => void;
onTrayCreateScratchpad(listener: () => void): () => void;
}
export interface RendererSelectionState {
+3
View File
@@ -65,6 +65,7 @@ export interface WorkspaceSettings {
discoveredUserTooling: DiscoveredToolingState;
terminalHeight?: number;
notificationsEnabled?: boolean;
minimizeToTray?: boolean;
}
export interface SessionToolingSelection {
@@ -206,6 +207,8 @@ export function normalizeWorkspaceSettings(settings?: Partial<WorkspaceSettings>
},
discoveredUserTooling: normalizeDiscoveredToolingState(settings?.discoveredUserTooling),
...(terminalHeight !== undefined ? { terminalHeight } : {}),
...(settings?.notificationsEnabled !== undefined ? { notificationsEnabled: settings.notificationsEnabled } : {}),
...(settings?.minimizeToTray !== undefined ? { minimizeToTray: settings.minimizeToTray } : {}),
};
}