Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(desktop): add version, gateway, and update check to tray menu
Jiayuan Zhang9bfef7126ba5
diff --git a/apps/desktop/src/main/index.ts b/apps/desktop/src/main/index.tsindex 5bc16b9218..da72ac87f4 100644--- a/apps/desktop/src/main/index.ts+++ b/apps/desktop/src/main/index.ts@@ -199,18 +199,20 @@ app.whenReady().then(async () => {createWindow()+ // Initialize auto-updater+ const forceDevUpdate = process.env.FORCE_DEV_UPDATE === 'true'+ updater = createUpdater(forceDevUpdate)+ updater.setMainWindow(() => win)+// Set up device confirmation flow, auth, and tray (requires window)if (win) {setupDeviceConfirmation(win)setAuthMainWindow(win)- createTray(win)+ createTray(win, {+ onCheckForUpdates: () => updater.checkForUpdates(),+ })}- // Initialize auto-updater- const forceDevUpdate = process.env.FORCE_DEV_UPDATE === 'true'- updater = createUpdater(forceDevUpdate)- updater.setMainWindow(() => win)-// Auto-check for updates in production (or when forced in dev)const isDev = !!VITE_DEV_SERVER_URLif (!isDev || forceDevUpdate) {diff --git a/apps/desktop/src/main/tray.ts b/apps/desktop/src/main/tray.tsindex 90436ce2fe..03ad11d3e8 100644--- a/apps/desktop/src/main/tray.ts+++ b/apps/desktop/src/main/tray.ts@@ -11,12 +11,18 @@ import { getCurrentHub, getDefaultAgent } from './ipc/hub.js'let tray: Tray | null = nulllet mainWindowRef: BrowserWindow | null = nulllet statusInterval: ReturnType<typeof setInterval> | null = null+let checkForUpdatesFn: (() => void) | null = null++export interface TrayOptions {+ onCheckForUpdates?: () => void+}/*** Create the system tray and start status polling.*/-export function createTray(window: BrowserWindow): void {+export function createTray(window: BrowserWindow, options?: TrayOptions): void {mainWindowRef = window+ checkForUpdatesFn = options?.onCheckForUpdates ?? null// Use dedicated tray icon (asterisk shape matching MulticaIcon).// On macOS, Electron auto-picks trayTemplate.png / [email protected]@@ -47,6 +53,7 @@ export function destroyTray(): void {tray = null}mainWindowRef = null+ checkForUpdatesFn = null}function showMainWindow(): void {@@ -63,9 +70,11 @@ function updateTrayMenu(): void {let agentStatus = 'Initializing'let hubStatus = 'Disconnected'+ let gatewayUrl = ''if (hub) {hubStatus = hub.connectionState === 'connected' ? 'Connected' : 'Disconnected'+ gatewayUrl = hub.url}if (agent && !agent.closed) {@@ -80,22 +89,31 @@ function updateTrayMenu(): void {tray.setToolTip(`Multica - Agent: ${agentStatus}`)- const menu = Menu.buildFromTemplate([+ const template: Electron.MenuItemConstructorOptions[] = [{ label: `Agent: ${agentStatus}`, enabled: false },{ label: `Hub: ${hubStatus}`, enabled: false },+ ]++ if (gatewayUrl) {+ template.push({ label: `Gateway: ${gatewayUrl}`, enabled: false })+ }++ template.push({ type: 'separator' },- {- label: 'Show Main Window',- click: showMainWindow,- },+ { label: 'Show Main Window', click: showMainWindow },{ type: 'separator' },- {- label: 'Quit Multica',- click: () => {- app.quit()- },- },- ])-- tray.setContextMenu(menu)+ { label: `Version ${app.getVersion()}`, enabled: false },+ )++ if (checkForUpdatesFn) {+ const fn = checkForUpdatesFn+ template.push({ label: 'Check for Updates', click: () => fn() })+ }++ template.push(+ { type: 'separator' },+ { label: 'Quit Multica', accelerator: 'CommandOrControl+Q', click: () => app.quit() },+ )++ tray.setContextMenu(Menu.buildFromTemplate(template))}