fix(desktop): use asterisk tray icon and show-only menu
- Replace resized app icon with dedicated tray icon matching MulticaIcon - Remove click-to-toggle behavior, add "Show Main Window" menu item - Include tray icon PNGs in electron-builder files config Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d2e22a6ec7
commit
5e03b4d76b
4 changed files with 11 additions and 22 deletions
BIN
apps/desktop/build/trayTemplate.png
Normal file
BIN
apps/desktop/build/trayTemplate.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 191 B |
BIN
apps/desktop/build/trayTemplate@2x.png
Normal file
BIN
apps/desktop/build/trayTemplate@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 326 B |
|
|
@ -10,6 +10,7 @@
|
|||
},
|
||||
"files": [
|
||||
"out",
|
||||
"build/trayTemplate*.png",
|
||||
"!**/.vscode/*",
|
||||
"!src/*",
|
||||
"!electron.vite.config.{js,ts,mjs,cjs}",
|
||||
|
|
|
|||
|
|
@ -18,20 +18,15 @@ let statusInterval: ReturnType<typeof setInterval> | null = null
|
|||
export function createTray(window: BrowserWindow): void {
|
||||
mainWindowRef = window
|
||||
|
||||
const iconPath = path.join(process.env.APP_ROOT!, 'build', 'icon.png')
|
||||
// Use dedicated tray icon (asterisk shape matching MulticaIcon).
|
||||
// On macOS, Electron auto-picks trayTemplate.png / trayTemplate@2x.png
|
||||
// and treats "Template" suffix as a template image (adapts to dark/light menu bar).
|
||||
const iconPath = path.join(process.env.APP_ROOT!, 'build', 'trayTemplate.png')
|
||||
const icon = nativeImage.createFromPath(iconPath)
|
||||
const trayIcon = icon.resize({ width: 16, height: 16 })
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
trayIcon.setTemplateImage(true)
|
||||
}
|
||||
|
||||
tray = new Tray(trayIcon)
|
||||
tray = new Tray(icon)
|
||||
tray.setToolTip('Multica')
|
||||
|
||||
// Click to toggle window visibility
|
||||
tray.on('click', toggleWindowVisibility)
|
||||
|
||||
// Initial menu
|
||||
updateTrayMenu()
|
||||
|
||||
|
|
@ -54,15 +49,10 @@ export function destroyTray(): void {
|
|||
mainWindowRef = null
|
||||
}
|
||||
|
||||
function toggleWindowVisibility(): void {
|
||||
function showMainWindow(): void {
|
||||
if (!mainWindowRef || mainWindowRef.isDestroyed()) return
|
||||
|
||||
if (mainWindowRef.isVisible()) {
|
||||
mainWindowRef.hide()
|
||||
} else {
|
||||
mainWindowRef.show()
|
||||
mainWindowRef.focus()
|
||||
}
|
||||
mainWindowRef.show()
|
||||
mainWindowRef.focus()
|
||||
}
|
||||
|
||||
function updateTrayMenu(): void {
|
||||
|
|
@ -90,15 +80,13 @@ function updateTrayMenu(): void {
|
|||
|
||||
tray.setToolTip(`Multica - Agent: ${agentStatus}`)
|
||||
|
||||
const windowVisible = mainWindowRef && !mainWindowRef.isDestroyed() && mainWindowRef.isVisible()
|
||||
|
||||
const menu = Menu.buildFromTemplate([
|
||||
{ label: `Agent: ${agentStatus}`, enabled: false },
|
||||
{ label: `Hub: ${hubStatus}`, enabled: false },
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: windowVisible ? 'Hide Window' : 'Show Window',
|
||||
click: toggleWindowVisibility,
|
||||
label: 'Show Main Window',
|
||||
click: showMainWindow,
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue