feat: Add Quit item to context menu
This commit is contained in:
+5
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user