From 45faa666bad96a1b63b847d664ddbe68def0378c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 1 Dec 2024 17:44:42 +0200 Subject: [PATCH] fix(native-buttons): enable buttons on other windows as well --- src/services/window.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/services/window.ts b/src/services/window.ts index 370df0e63..f60c5f783 100644 --- a/src/services/window.ts +++ b/src/services/window.ts @@ -31,7 +31,7 @@ async function createExtraWindow(extraWindowHash: string) { contextIsolation: false, spellcheck: spellcheckEnabled }, - frame: optionService.getOptionBool('nativeTitleBarVisible'), + ...getWindowExtraOpts(), icon: getIcon() }); @@ -71,11 +71,7 @@ async function createMainWindow(app: App) { const { BrowserWindow } = (await import('electron')); // should not be statically imported - const extraOpts: Partial = {}; - if (!optionService.getOptionBool('nativeTitleBarVisible')) { - extraOpts.titleBarStyle = "hidden"; - extraOpts.titleBarOverlay = (process.platform !== "darwin"); - } + mainWindow = new BrowserWindow({ x: mainWindowState.x, @@ -90,7 +86,7 @@ async function createMainWindow(app: App) { webviewTag: true }, icon: getIcon(), - ...extraOpts + ...getWindowExtraOpts() }); mainWindowState.manage(mainWindow); @@ -116,6 +112,16 @@ async function createMainWindow(app: App) { }); } +function getWindowExtraOpts() { + const extraOpts: Partial = {}; + if (!optionService.getOptionBool('nativeTitleBarVisible')) { + extraOpts.titleBarStyle = "hidden"; + extraOpts.titleBarOverlay = (process.platform !== "darwin"); + } + + return extraOpts; +} + function configureWebContents(webContents: WebContents, spellcheckEnabled: boolean) { remoteMain.enable(webContents);