[enhancement]: Start minimized (#522)

* [enhancement]: support starting minimized

* show window when dock clicked macos
This commit is contained in:
Kendall Garner 2024-02-23 16:31:17 +00:00 committed by GitHub
parent 77fa723cf8
commit 5caf0d439f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 5 deletions

View file

@ -131,6 +131,31 @@ export const WindowSettings = () => {
isHidden: !isElectron(),
title: t('setting.exitToTray', { postProcess: 'sentenceCase' }),
},
{
control: (
<Switch
aria-label="Toggle start in tray"
defaultChecked={settings.startMinimized}
disabled={!isElectron()}
onChange={(e) => {
if (!e) return;
localSettings?.set('window_start_minimized', e.currentTarget.checked);
setSettings({
window: {
...settings,
startMinimized: e.currentTarget.checked,
},
});
}}
/>
),
description: t('setting.startMinimized', {
context: 'description',
postProcess: 'sentenceCase',
}),
isHidden: !isElectron(),
title: t('setting.startMinimized', { postProcess: 'sentenceCase' }),
},
];
return <SettingsSection options={windowOptions} />;

View file

@ -267,6 +267,7 @@ export interface SettingsState {
disableAutoUpdate: boolean;
exitToTray: boolean;
minimizeToTray: boolean;
startMinimized: boolean;
windowBarStyle: Platform;
};
}
@ -575,6 +576,7 @@ const initialState: SettingsState = {
disableAutoUpdate: false,
exitToTray: false,
minimizeToTray: false,
startMinimized: false,
windowBarStyle: platformDefaultWindowBarStyle,
},
};