fix(native-buttons): enable buttons on other windows as well

This commit is contained in:
Elian Doran 2024-12-01 17:44:42 +02:00
parent 229825d99c
commit 45faa666ba

View File

@ -31,7 +31,7 @@ async function createExtraWindow(extraWindowHash: string) {
contextIsolation: false, contextIsolation: false,
spellcheck: spellcheckEnabled spellcheck: spellcheckEnabled
}, },
frame: optionService.getOptionBool('nativeTitleBarVisible'), ...getWindowExtraOpts(),
icon: getIcon() icon: getIcon()
}); });
@ -71,11 +71,7 @@ async function createMainWindow(app: App) {
const { BrowserWindow } = (await import('electron')); // should not be statically imported const { BrowserWindow } = (await import('electron')); // should not be statically imported
const extraOpts: Partial<BrowserWindowConstructorOptions> = {};
if (!optionService.getOptionBool('nativeTitleBarVisible')) {
extraOpts.titleBarStyle = "hidden";
extraOpts.titleBarOverlay = (process.platform !== "darwin");
}
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
x: mainWindowState.x, x: mainWindowState.x,
@ -90,7 +86,7 @@ async function createMainWindow(app: App) {
webviewTag: true webviewTag: true
}, },
icon: getIcon(), icon: getIcon(),
...extraOpts ...getWindowExtraOpts()
}); });
mainWindowState.manage(mainWindow); mainWindowState.manage(mainWindow);
@ -116,6 +112,16 @@ async function createMainWindow(app: App) {
}); });
} }
function getWindowExtraOpts() {
const extraOpts: Partial<BrowserWindowConstructorOptions> = {};
if (!optionService.getOptionBool('nativeTitleBarVisible')) {
extraOpts.titleBarStyle = "hidden";
extraOpts.titleBarOverlay = (process.platform !== "darwin");
}
return extraOpts;
}
function configureWebContents(webContents: WebContents, spellcheckEnabled: boolean) { function configureWebContents(webContents: WebContents, spellcheckEnabled: boolean) {
remoteMain.enable(webContents); remoteMain.enable(webContents);