From a1b5c21a8406bca4585ec1eda0a7136d434d4579 Mon Sep 17 00:00:00 2001 From: zackslash Date: Sat, 1 Jul 2023 21:50:11 +0100 Subject: [PATCH] use platform window bar style as default (#150) --- src/renderer/store/settings.store.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/renderer/store/settings.store.ts b/src/renderer/store/settings.store.ts index 3e0de8ae..80820120 100644 --- a/src/renderer/store/settings.store.ts +++ b/src/renderer/store/settings.store.ts @@ -21,6 +21,8 @@ import { Platform, } from '/@/renderer/types'; +const utils = isElectron() ? window.electron.utils : null; + export type SidebarItemType = { disabled: boolean; id: string; @@ -169,6 +171,13 @@ export interface SettingsSlice extends SettingsState { }; } +// Determines the default/initial windowBarStyle value based on the current platform. +const getPlatformDefaultWindowBarStyle = (): Platform => { + return isElectron() ? (utils.isMacOS() ? Platform.MACOS : Platform.WINDOWS) : Platform.WEB; +}; + +const platformDefaultWindowBarStyle: Platform = getPlatformDefaultWindowBarStyle(); + const initialState: SettingsState = { general: { followSystemTheme: false, @@ -369,7 +378,7 @@ const initialState: SettingsState = { disableAutoUpdate: false, exitToTray: false, minimizeToTray: false, - windowBarStyle: isElectron() ? Platform.WINDOWS : Platform.WEB, + windowBarStyle: platformDefaultWindowBarStyle, }, };