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",
|
"transcodeBitrate_description": "selects the bitrate to transcode. 0 means let the server pick",
|
||||||
"transcodeFormat": "format to transcode",
|
"transcodeFormat": "format to transcode",
|
||||||
"transcodeFormat_description": "selects the format to transcode. leave empty to let the server decide",
|
"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": "use system theme",
|
||||||
"useSystemTheme_description": "follow the system-defined light or dark preference",
|
"useSystemTheme_description": "follow the system-defined light or dark preference",
|
||||||
"volumeWheelStep": "volume wheel step",
|
"volumeWheelStep": "volume wheel step",
|
||||||
|
|
|
@ -647,7 +647,9 @@ if (!singleInstance) {
|
||||||
});
|
});
|
||||||
|
|
||||||
createWindow();
|
createWindow();
|
||||||
|
if (store.get('window_enable_tray', true)) {
|
||||||
createTray();
|
createTray();
|
||||||
|
}
|
||||||
app.on('activate', () => {
|
app.on('activate', () => {
|
||||||
// On macOS it's common to re-create a window in the app when the
|
// 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.
|
// dock icon is clicked and there are no other windows open.
|
||||||
|
|
|
@ -81,11 +81,55 @@ export const WindowSettings = () => {
|
||||||
isHidden: !isElectron(),
|
isHidden: !isElectron(),
|
||||||
title: t('setting.windowBarStyle', { postProcess: 'sentenceCase' }),
|
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: (
|
control: (
|
||||||
<Switch
|
<Switch
|
||||||
aria-label="Toggle minimize to tray"
|
aria-label="Toggle minimize to tray"
|
||||||
defaultChecked={settings.minimizeToTray}
|
defaultChecked={settings.tray}
|
||||||
disabled={!isElectron()}
|
disabled={!isElectron()}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
if (!e) return;
|
if (!e) return;
|
||||||
|
@ -103,7 +147,7 @@ export const WindowSettings = () => {
|
||||||
context: 'description',
|
context: 'description',
|
||||||
postProcess: 'sentenceCase',
|
postProcess: 'sentenceCase',
|
||||||
}),
|
}),
|
||||||
isHidden: !isElectron(),
|
isHidden: !isElectron() || !settings.tray,
|
||||||
title: t('setting.minimizeToTray', { postProcess: 'sentenceCase' }),
|
title: t('setting.minimizeToTray', { postProcess: 'sentenceCase' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -128,7 +172,7 @@ export const WindowSettings = () => {
|
||||||
context: 'description',
|
context: 'description',
|
||||||
postProcess: 'sentenceCase',
|
postProcess: 'sentenceCase',
|
||||||
}),
|
}),
|
||||||
isHidden: !isElectron(),
|
isHidden: !isElectron() || !settings.tray,
|
||||||
title: t('setting.exitToTray', { postProcess: 'sentenceCase' }),
|
title: t('setting.exitToTray', { postProcess: 'sentenceCase' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -153,7 +197,7 @@ export const WindowSettings = () => {
|
||||||
context: 'description',
|
context: 'description',
|
||||||
postProcess: 'sentenceCase',
|
postProcess: 'sentenceCase',
|
||||||
}),
|
}),
|
||||||
isHidden: !isElectron(),
|
isHidden: !isElectron() || !settings.tray,
|
||||||
title: t('setting.startMinimized', { postProcess: 'sentenceCase' }),
|
title: t('setting.startMinimized', { postProcess: 'sentenceCase' }),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -313,6 +313,7 @@ export interface SettingsState {
|
||||||
exitToTray: boolean;
|
exitToTray: boolean;
|
||||||
minimizeToTray: boolean;
|
minimizeToTray: boolean;
|
||||||
startMinimized: boolean;
|
startMinimized: boolean;
|
||||||
|
tray: boolean;
|
||||||
windowBarStyle: Platform;
|
windowBarStyle: Platform;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -647,6 +648,7 @@ const initialState: SettingsState = {
|
||||||
exitToTray: false,
|
exitToTray: false,
|
||||||
minimizeToTray: false,
|
minimizeToTray: false,
|
||||||
startMinimized: false,
|
startMinimized: false,
|
||||||
|
tray: true,
|
||||||
windowBarStyle: platformDefaultWindowBarStyle,
|
windowBarStyle: platformDefaultWindowBarStyle,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue