Fix behaviour, if "Show icon on menu bar" was previously not selected
This commit is contained in:
@@ -47,6 +47,19 @@ var SettingsPage = React.createClass({
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
var currentWindow = remote.getCurrentWindow();
|
||||
if (currentWindow.tray) {
|
||||
this.setState({
|
||||
trayWasVisible: true
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
trayWasVisible: false
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
handleTeamsChange: function(teams) {
|
||||
this.setState({
|
||||
@@ -181,8 +194,8 @@ var SettingsPage = React.createClass({
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
options.push(<Input key="inputMinimizeToTray" id="inputMinimizeToTray" ref="minimizeToTray" type="checkbox" label="Leave app running in notification area when the window is closed"
|
||||
disabled={ !this.state.showTrayIcon } checked={ this.state.minimizeToTray } onChange={ this.handleChangeMinimizeToTray } />);
|
||||
options.push(<Input key="inputMinimizeToTray" id="inputMinimizeToTray" ref="minimizeToTray" type="checkbox" label={ this.state.trayWasVisible || !this.state.showTrayIcon ? "Leave app running in notification area when the window is closed" : "Leave app running in notification area when the window is closed (available on next restart)" } disabled={ !this.state.showTrayIcon || !this.state.trayWasVisible } checked={ this.state.minimizeToTray }
|
||||
onChange={ this.handleChangeMinimizeToTray } />);
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
|
@@ -358,6 +358,11 @@ app.on('ready', function() {
|
||||
if (shouldShowTrayIcon()) {
|
||||
const tray_menu = require('./main/menus/tray').createDefault(mainWindow);
|
||||
trayIcon.setContextMenu(tray_menu);
|
||||
if (process.platform === 'darwin') {
|
||||
// store a reference to the tray icon, for checking in the settings, if the application
|
||||
// was restarted after setting "Show icon on menu bar"
|
||||
mainWindow.tray = trayIcon;
|
||||
}
|
||||
}
|
||||
|
||||
// Open the DevTools.
|
||||
|
Reference in New Issue
Block a user