From 00b2b497f0e9256aba79586bd79856a6c9bec320 Mon Sep 17 00:00:00 2001 From: Jing Hua Date: Sun, 23 Apr 2023 15:56:58 +0800 Subject: [PATCH] fix: electron minimise --- electron/index.cjs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/electron/index.cjs b/electron/index.cjs index dede82a..03a2d2e 100644 --- a/electron/index.cjs +++ b/electron/index.cjs @@ -24,11 +24,6 @@ function createWindow() { createTray(win); - win.on('minimize', (event) => { - event.preventDefault(); - win.hide(); - }); - win.maximize(); win.show(); @@ -51,7 +46,13 @@ const createTray = (window) => { ) ); const contextMenu = Menu.buildFromTemplate([ - { label: 'Show', click: () => window.show() }, + { + label: 'Show', + click: () => { + win.maximize(); + window.show(); + }, + }, { label: 'Exit', 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.setContextMenu(contextMenu);