diff --git a/src/main.ts b/src/main.ts index c270a22..e4ee6ac 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, ipcMain, nativeImage, shell, Tray } from 'electron'; +import { app, BrowserWindow, ipcMain, Menu, nativeImage, shell, Tray } from 'electron'; import path from 'node:path'; import started from 'electron-squirrel-startup'; import { APP_NAME, DEFAULT_STATUS, GATEWAY_HOST, MANAGEMENT_URL, POLL_INTERVAL_MS, WINDOW_HEIGHT, WINDOW_WIDTH } from './config'; @@ -187,6 +187,10 @@ function showWindow() { function createTray() { const icon = nativeImage.createFromPath(resourcePath('VynteIcon.png')).resize({ width: 18, height: 18 }); tray = new Tray(icon); + const contextMenu = Menu.buildFromTemplate([ + { role: 'quit' } + ]); + tray.setContextMenu(contextMenu); tray.setToolTip(APP_NAME); tray.on('click', showWindow); }