feat(desktop): native desktop enhancements

- Add a minimal application menu with common items and shortcuts:
  New Chat (Cmd+N), Settings (Cmd+,), Reload, etc.
- Add system tray with show window, new chat, and quit; click icon to restore
- Add single-instance lock so relaunching focuses the existing window
- Implement close-to-tray: closing the window hides it; only a real quit destroys it
- Explicitly define Window menu's Close Window bound to Cmd+W / Ctrl+W to reliably trigger hide-to-tray
- Listen for menu-action in the renderer to handle menu-triggered new chat / open settings
This commit is contained in:
zhayujie
2026-06-22 15:32:22 +08:00
parent d1336b872e
commit 49452e035d
6 changed files with 226 additions and 1 deletions

View File

@@ -24,5 +24,10 @@ contextBridge.exposeInMainWorld('electronAPI', {
ipcRenderer.on('window-maximize-changed', (_event, max) => callback(max))
},
// App menu / shortcut actions forwarded from the main process.
onMenuAction: (callback: (action: string) => void) => {
ipcRenderer.on('menu-action', (_event, action: string) => callback(action))
},
platform: process.platform,
})