From 6d092d9ebc9c6bdf50a31d0e780db98c4275dfcd Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sat, 27 May 2023 04:24:47 -0700 Subject: [PATCH] Add native frame styles per OS --- src/main/main.ts | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/main/main.ts b/src/main/main.ts index 7d95d1857..3c3720bfc 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -20,6 +20,7 @@ import { Tray, Menu, nativeImage, + BrowserWindowConstructorOptions, } from 'electron'; import electronLocalShortcut from 'electron-localshortcut'; import log from 'electron-log'; @@ -186,9 +187,26 @@ const createWindow = async () => { const nativeFrame = store.get('window_window_bar_style') === 'linux'; store.set('window_has_frame', nativeFrame); + const nativeFrameConfig: Record = { + linux: { + autoHideMenuBar: true, + frame: true, + }, + macOS: { + autoHideMenuBar: true, + frame: false, + titleBarStyle: 'hidden', + trafficLightPosition: { x: 10, y: 10 }, + }, + windows: { + autoHideMenuBar: true, + frame: true, + }, + }; + mainWindow = new BrowserWindow({ - autoHideMenuBar: nativeFrame, - frame: nativeFrame, + autoHideMenuBar: true, + frame: false, height: 900, icon: getAssetPath('icon.png'), minHeight: 600, @@ -206,6 +224,9 @@ const createWindow = async () => { webSecurity: !store.get('ignore_cors'), }, width: 1440, + ...(nativeFrame && isLinux() && nativeFrameConfig.linux), + ...(nativeFrame && isMacOS() && nativeFrameConfig.macOS), + ...(nativeFrame && isWindows() && nativeFrameConfig.windows), }); electronLocalShortcut.register(mainWindow, 'Ctrl+Shift+I', () => {