enable disabling tray
This commit is contained in:
parent
74aa88e082
commit
1b41a5a674
4 changed files with 55 additions and 5 deletions
|
@ -653,6 +653,8 @@
|
|||
"transcodeBitrate_description": "selects the bitrate to transcode. 0 means let the server pick",
|
||||
"transcodeFormat": "format to transcode",
|
||||
"transcodeFormat_description": "selects the format to transcode. leave empty to let the server decide",
|
||||
"trayEnabled": "show tray",
|
||||
"trayEnabled_description": "show/hide tray icon/menu. if disabled, also disables minimize/exit to tray",
|
||||
"useSystemTheme": "use system theme",
|
||||
"useSystemTheme_description": "follow the system-defined light or dark preference",
|
||||
"volumeWheelStep": "volume wheel step",
|
||||
|
|
|
@ -647,7 +647,9 @@ if (!singleInstance) {
|
|||
});
|
||||
|
||||
createWindow();
|
||||
if (store.get('window_enable_tray', true)) {
|
||||
createTray();
|
||||
}
|
||||
app.on('activate', () => {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
|
|
|
@ -81,11 +81,55 @@ export const WindowSettings = () => {
|
|||
isHidden: !isElectron(),
|
||||
title: t('setting.windowBarStyle', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
{
|
||||
control: (
|
||||
<Switch
|
||||
aria-label="toggle hiding tray"
|
||||
defaultChecked={settings.tray}
|
||||
disabled={!isElectron()}
|
||||
onChange={(e) => {
|
||||
if (!e) return;
|
||||
localSettings?.set('window_enable_tray', e.currentTarget.checked);
|
||||
if (e.currentTarget.checked) {
|
||||
setSettings({
|
||||
window: {
|
||||
...settings,
|
||||
tray: true,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
localSettings?.set('window_start_minimized', false);
|
||||
localSettings?.set('window_exit_to_tray', false);
|
||||
localSettings?.set('window_minimize_to_tray', false);
|
||||
|
||||
setSettings({
|
||||
window: {
|
||||
...settings,
|
||||
exitToTray: false,
|
||||
minimizeToTray: false,
|
||||
startMinimized: false,
|
||||
tray: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
),
|
||||
description: t('setting.trayEnabled', {
|
||||
context: 'description',
|
||||
postProcess: 'sentenceCase',
|
||||
}),
|
||||
isHidden: !isElectron(),
|
||||
note: t('common.restartRequired', {
|
||||
postProcess: 'sentenceCase',
|
||||
}),
|
||||
title: t('setting.trayEnabled', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
{
|
||||
control: (
|
||||
<Switch
|
||||
aria-label="Toggle minimize to tray"
|
||||
defaultChecked={settings.minimizeToTray}
|
||||
defaultChecked={settings.tray}
|
||||
disabled={!isElectron()}
|
||||
onChange={(e) => {
|
||||
if (!e) return;
|
||||
|
@ -103,7 +147,7 @@ export const WindowSettings = () => {
|
|||
context: 'description',
|
||||
postProcess: 'sentenceCase',
|
||||
}),
|
||||
isHidden: !isElectron(),
|
||||
isHidden: !isElectron() || !settings.tray,
|
||||
title: t('setting.minimizeToTray', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
{
|
||||
|
@ -128,7 +172,7 @@ export const WindowSettings = () => {
|
|||
context: 'description',
|
||||
postProcess: 'sentenceCase',
|
||||
}),
|
||||
isHidden: !isElectron(),
|
||||
isHidden: !isElectron() || !settings.tray,
|
||||
title: t('setting.exitToTray', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
{
|
||||
|
@ -153,7 +197,7 @@ export const WindowSettings = () => {
|
|||
context: 'description',
|
||||
postProcess: 'sentenceCase',
|
||||
}),
|
||||
isHidden: !isElectron(),
|
||||
isHidden: !isElectron() || !settings.tray,
|
||||
title: t('setting.startMinimized', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
];
|
||||
|
|
|
@ -313,6 +313,7 @@ export interface SettingsState {
|
|||
exitToTray: boolean;
|
||||
minimizeToTray: boolean;
|
||||
startMinimized: boolean;
|
||||
tray: boolean;
|
||||
windowBarStyle: Platform;
|
||||
};
|
||||
}
|
||||
|
@ -647,6 +648,7 @@ const initialState: SettingsState = {
|
|||
exitToTray: false,
|
||||
minimizeToTray: false,
|
||||
startMinimized: false,
|
||||
tray: true,
|
||||
windowBarStyle: platformDefaultWindowBarStyle,
|
||||
},
|
||||
};
|
||||
|
|
Reference in a new issue