fix: electron minimise

This commit is contained in:
Jing Hua 2023-04-23 15:56:58 +08:00
parent d58ec90b5b
commit 00b2b497f0

View file

@ -24,11 +24,6 @@ function createWindow() {
createTray(win); createTray(win);
win.on('minimize', (event) => {
event.preventDefault();
win.hide();
});
win.maximize(); win.maximize();
win.show(); win.show();
@ -51,7 +46,13 @@ const createTray = (window) => {
) )
); );
const contextMenu = Menu.buildFromTemplate([ const contextMenu = Menu.buildFromTemplate([
{ label: 'Show', click: () => window.show() }, {
label: 'Show',
click: () => {
win.maximize();
window.show();
},
},
{ {
label: 'Exit', label: 'Exit',
click: () => { click: () => {
@ -61,7 +62,10 @@ const createTray = (window) => {
}, },
]); ]);
tray.on('click', () => window.show()); tray.on('click', () => {
win.maximize();
window.show();
});
tray.setToolTip('Better ChatGPT'); tray.setToolTip('Better ChatGPT');
tray.setContextMenu(contextMenu); tray.setContextMenu(contextMenu);