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) {
|
handleTeamsChange: function(teams) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -181,8 +194,8 @@ var SettingsPage = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
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"
|
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 }
|
||||||
disabled={ !this.state.showTrayIcon } checked={ this.state.minimizeToTray } onChange={ this.handleChangeMinimizeToTray } />);
|
onChange={ this.handleChangeMinimizeToTray } />);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
|
@@ -358,6 +358,11 @@ app.on('ready', function() {
|
|||||||
if (shouldShowTrayIcon()) {
|
if (shouldShowTrayIcon()) {
|
||||||
const tray_menu = require('./main/menus/tray').createDefault(mainWindow);
|
const tray_menu = require('./main/menus/tray').createDefault(mainWindow);
|
||||||
trayIcon.setContextMenu(tray_menu);
|
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.
|
// Open the DevTools.
|
||||||
|
Reference in New Issue
Block a user