OSX: Added Option to hide Window from dock on close

This commit is contained in:
Martin Gondermann
2016-06-30 22:17:31 +02:00
parent 0f6688b4cf
commit 865b08105a
6 changed files with 49 additions and 7 deletions

View File

@@ -102,9 +102,16 @@ var SettingsPage = React.createClass({
});
},
handleChangeShowTrayIcon: function() {
var shouldShowTrayIcon = this.refs.showTrayIcon.getChecked();
this.setState({
showTrayIcon: this.refs.showTrayIcon.getChecked()
showTrayIcon: shouldShowTrayIcon
});
if (process.platform === 'darwin' && !shouldShowTrayIcon) {
this.setState({
minimizeToTray: false
});
}
},
handleChangeTrayIconTheme: function() {
this.setState({
@@ -117,8 +124,11 @@ var SettingsPage = React.createClass({
});
},
handleChangeMinimizeToTray: function() {
var shouldMinimizeToTray = (process.platform !== 'darwin' || this.refs.showTrayIcon.getChecked())
&& this.refs.minimizeToTray.getChecked();
this.setState({
minimizeToTray: this.refs.minimizeToTray.getChecked()
minimizeToTray: shouldMinimizeToTray
});
},
handleChangeToggleWindowOnTrayIconClick: function() {
@@ -172,6 +182,12 @@ var SettingsPage = React.createClass({
if (process.platform === 'win32') {
options.push(<Input key="inputMinimizeToTray" id="inputMinimizeToTray" ref="minimizeToTray" type="checkbox" label="Leave app running in notification area when the window is closed"
checked={ this.state.minimizeToTray } onChange={ this.handleChangeMinimizeToTray } />);
} else 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 } />);
}
if (process.platform === 'win32') {
options.push(<Input key="inputToggleWindowOnTrayIconClick" id="inputToggleWindowOnTrayIconClick" ref="toggleWindowOnTrayIconClick" type="checkbox" label="Toggle window visibility when clicking on the tray icon."
checked={ this.state.toggleWindowOnTrayIconClick } onChange={ this.handleChangeToggleWindowOnTrayIconClick } />);
}