diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a5668b6..a08e157a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,8 @@ Release date: TBD [#512](https://github.com/mattermost/desktop/issues/512) - Added the feature to open the application via `mattermost://` link. [#616](https://github.com/mattermost/desktop/pull/616) + - Added the option to bounce the Dock icon when receiving new messages. + [#514](https://github.com/mattermost/desktop/issues/514) ### Bug Fixes diff --git a/src/browser/components/SettingsPage.jsx b/src/browser/components/SettingsPage.jsx index 9d4d6ac2..4604b1fa 100644 --- a/src/browser/components/SettingsPage.jsx +++ b/src/browser/components/SettingsPage.jsx @@ -129,7 +129,9 @@ const SettingsPage = createReactClass({ version: settings.version, minimizeToTray: this.state.minimizeToTray, notifications: { - flashWindow: this.state.notifications.flashWindow + flashWindow: this.state.notifications.flashWindow, + bounceIcon: this.state.notifications.bounceIcon, + bounceIconType: this.state.notifications.bounceIconType }, showUnreadBadge: this.state.showUnreadBadge, useSpellChecker: this.state.useSpellChecker, @@ -219,11 +221,30 @@ const SettingsPage = createReactClass({ handleFlashWindow() { this.setState({ notifications: { + ...this.state.notifications, flashWindow: this.refs.flashWindow.props.checked ? 0 : 2 } }); setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS); }, + handleBounceIcon() { + this.setState({ + notifications: { + ...this.state.notifications, + bounceIcon: !this.refs.bounceIcon.props.checked + } + }); + setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS); + }, + handleBounceIconType(event) { + this.setState({ + notifications: { + ...this.state.notifications, + bounceIconType: event.target.value + } + }); + setImmediate(this.startSaveConfig, CONFIG_TYPE_APP_OPTIONS); + }, handleShowUnreadBadge() { this.setState({ showUnreadBadge: !this.refs.showUnreadBadge.props.checked @@ -419,6 +440,48 @@ const SettingsPage = createReactClass({ ); } + if (process.platform === 'darwin') { + options.push( + + {'Bounce the Dock icon'} + + {'once'} + {' '} + {'until I open the app'} + + {'If enabled, the Dock icon bounces once or until the user opens the app when a new message is received.'} + + + ); + } + if (process.platform === 'darwin' || process.platform === 'linux') { options.push( { mainWindow.flashFrame(true); } } + + if (process.platform === 'darwin' && config.notifications.bounceIcon) { + app.dock.bounce(config.notifications.bounceIconType); + } }); ipcMain.on('update-title', (event, arg) => {