Removed option to minimize to tray, this is now the default behaviour

This commit is contained in:
Martin Gondermann
2016-07-03 14:58:48 +02:00
parent 0a289c5237
commit 2919b1af5f
5 changed files with 16 additions and 56 deletions

View File

@@ -61,7 +61,6 @@ var SettingsPage = React.createClass({
trayIconTheme: this.state.trayIconTheme,
disablewebsecurity: this.state.disablewebsecurity,
version: settings.version,
minimizeToTray: this.state.minimizeToTray,
toggleWindowOnTrayIconClick: this.state.toggleWindowOnTrayIconClick,
notifications: {
flashWindow: this.state.notifications.flashWindow
@@ -106,12 +105,6 @@ var SettingsPage = React.createClass({
this.setState({
showTrayIcon: shouldShowTrayIcon
});
if (process.platform === 'darwin' && !shouldShowTrayIcon) {
this.setState({
minimizeToTray: false
});
}
},
handleChangeTrayIconTheme: function() {
this.setState({
@@ -123,14 +116,6 @@ var SettingsPage = React.createClass({
autostart: this.refs.autostart.getChecked()
});
},
handleChangeMinimizeToTray: function() {
var shouldMinimizeToTray = (process.platform !== 'darwin' || this.refs.showTrayIcon.getChecked())
&& this.refs.minimizeToTray.getChecked();
this.setState({
minimizeToTray: shouldMinimizeToTray
});
},
handleChangeToggleWindowOnTrayIconClick: function() {
this.setState({
toggleWindowOnTrayIconClick: this.refs.toggleWindowOnTrayIconClick.getChecked()
@@ -179,18 +164,12 @@ var SettingsPage = React.createClass({
options.push(<Input key="inputAutoStart" id="inputAutoStart" ref="autostart" type="checkbox" label="Start app on login." checked={ this.state.autostart } onChange={ this.handleChangeAutoStart }
/>);
}
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 } />);
}
var options_row = (options.length > 0) ? (
<Row>
<Col md={ 12 }>

View File

@@ -261,12 +261,15 @@ app.on('ready', function() {
trayIcon.popUpContextMenu();
});
trayIcon.on('balloon-click', function() {
if (process.platform === 'win32') {
if (config.minimizeToTray) {
mainWindow.show();
mainWindow.isHidden = false;
}
if (process.platform === 'win32' || process.platform === 'darwin') {
mainWindow.show();
mainWindow.isHidden = false;
}
if (process.platform === 'darwin') {
app.dock.show();
}
mainWindow.focus();
});
ipcMain.on('notified', function(event, arg) {
@@ -380,26 +383,16 @@ app.on('ready', function() {
event.preventDefault();
switch (process.platform) {
case 'win32':
if (config.minimizeToTray) {
mainWindow.hide();
mainWindow.isHidden = true;
}
else {
mainWindow.minimize();
}
mainWindow.hide();
mainWindow.isHidden = true;
break;
case 'linux':
mainWindow.minimize();
break;
case 'darwin':
if (config.minimizeToTray) {
mainWindow.hide();
app.dock.hide();
mainWindow.isHidden = true;
}
else {
mainWindow.minimize();
}
mainWindow.hide();
app.dock.hide();
mainWindow.isHidden = true;
break;
default:
}