use platform window bar style as default (#150)

This commit is contained in:
zackslash 2023-07-01 21:50:11 +01:00 committed by GitHub
parent 4c5fa0750b
commit a1b5c21a84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,
},
};