update:配置是否可编辑rsa秘钥

This commit is contained in:
贾同学
2025-10-20 09:08:24 +08:00
parent d57127cb6a
commit 755639c1fb
5 changed files with 38 additions and 14 deletions

View File

@@ -1,9 +1,9 @@
import { Tray, Menu } from 'electron';
import {app as electronApp, Menu, Tray} from 'electron';
import path from 'path';
import { isDev, getBaseDir } from 'ee-core/ps';
import { logger } from 'ee-core/log';
import { app as electronApp } from 'electron';
import { getMainWindow, getCloseAndQuit, setCloseAndQuit } from 'ee-core/electron';
import {getBaseDir} from 'ee-core/ps';
import {logger} from 'ee-core/log';
import {getConfig} from 'ee-core/config';
import {getCloseAndQuit, getMainWindow, setCloseAndQuit} from 'ee-core/electron';
/**
* 托盘
@@ -19,7 +19,7 @@ class TrayService {
constructor() {
this.tray = null;
this.config = {
title: 'electron-egg',
title: electronApp.name,
icon: '/public/images/tray.png',
}
}
@@ -51,9 +51,10 @@ class TrayService {
}
}
]
setCloseAndQuit(true);
// Set a flag to minimize to tray instead of closing
setCloseAndQuit(false);
// setCloseAndQuit(false);
mainWindow.on('close', (event: any) => {
if (getCloseAndQuit()) {
return;
@@ -64,6 +65,10 @@ class TrayService {
// Initialize the tray
this.tray = new Tray(iconPath);
const { windowsOption } = getConfig();
if (windowsOption.title) {
cfg.title = windowsOption.title;
}
this.tray.setToolTip(cfg.title);
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate);
this.tray.setContextMenu(contextMenu);