diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b705d91..5c4c3994 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,9 @@ - Fixed the pixelated app icon on the top left of the window. - Fixed the blurred tray icon. - Fixed that the redundant description appears in the pinned start menu on Windows 7. -- The main window is now minimized to system tray on close -- Added Option to toggle minimize/restore on click on system tray icon #### OS X - Fixed that two icons appear on a notification. -- Added Option to hide Window from dock on close ### Improvements - Added shortcuts @@ -42,14 +39,18 @@ - Added the tooltip text for the tray icon in order to show count of unread channels/mantions. - Added the option to launch the application on login. - Added the option to blink the taskbar icon when a new message has arrived. +- The main window is now minimized to system tray on close +- Added Option to toggle minimize/restore on click on system tray icon - Added installers (experimental) #### OS X - Added colored badges to the menu icon when there are unread channels/mentions. +- Added Option to hide Window from dock on close #### Linux - Added the option to show the icon on menu bar. (requires libappindicator1 on Ubuntu) - Added the option to launch the application on login. +- Added Option to hide Window into tray icon on close ## Release v1.2.1 (Beta) diff --git a/docs/setup.md b/docs/setup.md index 7f2c5e55..cd00f39a 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -124,7 +124,7 @@ The Settings Page is available from the **File** menu under **Settings** (Click This option allows such images to be rendered, but please be careful for security. - **Start app on login** (Windows, Linux) - This option starts the application when you login. - - **Leave app running in notification area when the window is closed** (OS X) + - **Leave app running in notification area when the window is closed** (OS X, Linux) - This option hides the window from the dock, if the window is closed - **Toggle window visibility when clicking on the tray icon** (Windows) - If checked, then a click on the system tray icon leads to a toggling of the minimized/maximized state of the window diff --git a/src/browser/settings.jsx b/src/browser/settings.jsx index 252131c1..3cfe5282 100644 --- a/src/browser/settings.jsx +++ b/src/browser/settings.jsx @@ -27,16 +27,17 @@ function backToIndex() { var SettingsPage = React.createClass({ getInitialState: function() { - var config; + var initialState; try { - config = settings.readFileSync(this.props.configFile); + initialState = settings.readFileSync(this.props.configFile); } catch (e) { - config = settings.loadDefault(); + initialState = settings.loadDefault(); } - config.showAddTeamForm = false; + initialState.showAddTeamForm = false; + initialState.trayWasVisible = remote.getCurrentWindow().trayWasVisible; - return config; + return initialState; }, componentDidMount: function() { if (process.platform === 'win32' || process.platform === 'linux') { @@ -47,13 +48,6 @@ var SettingsPage = React.createClass({ }); }); } - - if (process.platform === 'darwin') { - var currentWindow = remote.getCurrentWindow(); - this.setState({ - trayWasVisible: currentWindow.trayWasVisible - }); - } }, handleTeamsChange: function(teams) { this.setState({ @@ -188,7 +182,7 @@ var SettingsPage = React.createClass({ />); } - if (process.platform === 'darwin') { + if (process.platform === 'darwin' || process.platform === 'linux') { options.push(); } diff --git a/src/main.js b/src/main.js index cb458770..827902b4 100644 --- a/src/main.js +++ b/src/main.js @@ -160,7 +160,6 @@ app.on('browser-window-created', function(event, window) { // For OSX, show hidden mainWindow when clicking dock icon. app.on('activate', function(event) { mainWindow.show(); - mainWindow.isHidden = false; }); app.on('before-quit', function() { @@ -232,29 +231,15 @@ app.on('ready', function() { trayIcon.setToolTip(app.getName()); trayIcon.on('click', function() { - if (process.platform === 'win32') { - if (mainWindow.isHidden || mainWindow.isMinimized()) { - mainWindow.show(); - mainWindow.isHidden = false; - mainWindow.focus(); - } - else if (config.toggleWindowOnTrayIconClick) { - mainWindow.minimize(); - } - else { - mainWindow.focus(); - } - } - else if (process.platform === 'darwin') { - if (mainWindow.isHidden || mainWindow.isMinimized()) { - mainWindow.show(); - mainWindow.isHidden = false; - mainWindow.focus(); + if (!mainWindow.isVisible() || mainWindow.isMinimized()) { + mainWindow.show(); + mainWindow.focus(); + if (process.platform === 'darwin') { app.dock.show(); } - else { - mainWindow.focus(); - } + } + else if ((process.platform === 'win32') && config.toggleWindowOnTrayIconClick) { + mainWindow.minimize(); } else { mainWindow.focus(); @@ -267,7 +252,6 @@ app.on('ready', function() { trayIcon.on('balloon-click', function() { if (process.platform === 'win32' || process.platform === 'darwin') { mainWindow.show(); - mainWindow.isHidden = false; } if (process.platform === 'darwin') { @@ -404,16 +388,19 @@ app.on('ready', function() { switch (process.platform) { case 'win32': mainWindow.hide(); - mainWindow.isHidden = true; break; case 'linux': - mainWindow.minimize(); + if (config.minimizeToTray) { + mainWindow.hide(); + } + else { + mainWindow.minimize(); + } break; case 'darwin': mainWindow.hide(); if (config.minimizeToTray) { app.dock.hide(); - mainWindow.isHidden = true; } break; default: diff --git a/src/main/menus/tray.js b/src/main/menus/tray.js index 0e41b08e..93431e98 100644 --- a/src/main/menus/tray.js +++ b/src/main/menus/tray.js @@ -15,7 +15,6 @@ function createTemplate(mainWindow, config) { click: (item, focusedWindow) => { mainWindow.show(); // for OS X mainWindow.webContents.send('switch-tab', i); - mainWindow.isHidden = false; if (process.platform === 'darwin') { app.dock.show(); diff --git a/test/specs/browser/settings_test.js b/test/specs/browser/settings_test.js index 92229e7e..17e3969e 100644 --- a/test/specs/browser/settings_test.js +++ b/test/specs/browser/settings_test.js @@ -152,8 +152,8 @@ describe('browser/settings.html', function() { }); describe('Minimize to tray', function() { - it('should appear on darwin', function() { - const expected = (process.platform === 'darwin'); + it('should appear on darwin or linux', function() { + const expected = (process.platform === 'darwin' || process.platform === 'linux'); env.addClientCommands(this.app.client); return this.app.client .loadSettingsPage()