diff --git a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js index 0b472cc366..17eea49236 100644 --- a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js @@ -59,24 +59,39 @@ export default class PreferencesUserSettingsTab extends React.Component { this.state = { autoLaunch: false, autoLaunchSupported: false, + minimizeToTray: true, + minimizeToTraySupported: false, }; } async componentWillMount(): void { - const autoLaunchSupported = await PlatformPeg.get().supportsAutoLaunch(); + const platform = PlatformPeg.get(); + + const autoLaunchSupported = await platform.supportsAutoLaunch(); let autoLaunch = false; if (autoLaunchSupported) { - autoLaunch = await PlatformPeg.get().getAutoLaunchEnabled(); + autoLaunch = await platform.getAutoLaunchEnabled(); } - this.setState({autoLaunch, autoLaunchSupported}); + const minimizeToTraySupported = await platform.supportsMinimizeToTray(); + let minimizeToTray = true; + + if (minimizeToTraySupported) { + minimizeToTray = await platform.getMinimizeToTrayEnabled(); + } + + this.setState({autoLaunch, autoLaunchSupported, minimizeToTraySupported, minimizeToTray}); } _onAutoLaunchChange = (checked) => { PlatformPeg.get().setAutoLaunchEnabled(checked).then(() => this.setState({autoLaunch: checked})); }; + _onMinimizeToTrayChange = (checked) => { + PlatformPeg.get().setMinimizeToTrayEnabled(checked).then(() => this.setState({minimizeToTray: checked})); + }; + _onAutocompleteDelayChange = (e) => { SettingsStore.setValue("autocompleteDelay", null, SettingLevel.DEVICE, e.target.value); }; @@ -94,6 +109,13 @@ export default class PreferencesUserSettingsTab extends React.Component { label={_t('Start automatically after system login')} />; } + let minimizeToTrayOption = null; + if (this.state.minimizeToTraySupported) { + minimizeToTrayOption = ; + } + return (
{_t("Preferences")}
@@ -106,6 +128,7 @@ export default class PreferencesUserSettingsTab extends React.Component { {_t("Advanced")} {this._renderGroup(PreferencesUserSettingsTab.ADVANCED_SETTINGS)} + {minimizeToTrayOption} {autoLaunchOption}