From c464be8cea491b8e0426d10308b4a5afc3a09135 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Wed, 27 Sep 2023 02:37:03 -0700 Subject: [PATCH] Fix quit functionality (#184) --- src/main/main.ts | 5 +++++ src/main/preload/browser.ts | 8 ++++++++ src/renderer/features/titlebar/components/app-menu.tsx | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/main.ts b/src/main/main.ts index fb2914155..1d2932971 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -259,6 +259,11 @@ const createWindow = async () => { mainWindow?.close(); }); + ipcMain.on('window-quit', () => { + mainWindow?.close(); + app.exit(); + }); + ipcMain.on('app-restart', () => { // Fix for .AppImage if (process.env.APPIMAGE) { diff --git a/src/main/preload/browser.ts b/src/main/preload/browser.ts index b9b18429a..d24e739a6 100644 --- a/src/main/preload/browser.ts +++ b/src/main/preload/browser.ts @@ -3,16 +3,23 @@ import { ipcRenderer } from 'electron'; const exit = () => { ipcRenderer.send('window-close'); }; + const maximize = () => { ipcRenderer.send('window-maximize'); }; + const minimize = () => { ipcRenderer.send('window-minimize'); }; + const unmaximize = () => { ipcRenderer.send('window-unmaximize'); }; +const quit = () => { + ipcRenderer.send('window-quit'); +}; + const devtools = () => { ipcRenderer.send('window-dev-tools'); }; @@ -22,5 +29,6 @@ export const browser = { exit, maximize, minimize, + quit, unmaximize, }; diff --git a/src/renderer/features/titlebar/components/app-menu.tsx b/src/renderer/features/titlebar/components/app-menu.tsx index de845bf05..5346c335a 100644 --- a/src/renderer/features/titlebar/components/app-menu.tsx +++ b/src/renderer/features/titlebar/components/app-menu.tsx @@ -91,7 +91,7 @@ export const AppMenu = () => { }; const handleQuit = () => { - browser?.exit(); + browser?.quit(); }; return (