diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dc1c5cf..b7aef4f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,16 @@ # Mattermost Desktop Application Changelog +## Release v1.3.0 (Beta) + +### Improvements +#### Linux +- Add the option to show the icon on menu bar. (requires libappindicator1 on Ubuntu) + ## Release v1.2.0 (Beta) +- **Released:** 2016-05-17 + This release contains a security update and it is highly recommended that users upgrade to this version. ### Fixes diff --git a/src/browser/index.jsx b/src/browser/index.jsx index f98c35bd..671c683b 100644 --- a/src/browser/index.jsx +++ b/src/browser/index.jsx @@ -486,6 +486,21 @@ var showUnreadBadgeOSX = function(unreadCount, mentionCount) { }); } +var showUnreadBadgeLinux = function(unreadCount, mentionCount) { + /*if (mentionCount > 0) { + remote.app.dock.setBadge(mentionCount.toString()); + } else if (unreadCount > 0) { + remote.app.dock.setBadge('•'); + } else { + remote.app.dock.setBadge(''); + }*/ + + electron.ipcRenderer.send('update-unread', { + unreadCount: unreadCount, + mentionCount: mentionCount + }); +} + var showUnreadBadge = function(unreadCount, mentionCount) { switch (process.platform) { case 'win32': @@ -494,6 +509,10 @@ var showUnreadBadge = function(unreadCount, mentionCount) { case 'darwin': showUnreadBadgeOSX(unreadCount, mentionCount); break; + case 'linux': + console.log(unreadCount); + showUnreadBadgeLinux(unreadCount, mentionCount); + break; default: } } diff --git a/src/browser/settings.jsx b/src/browser/settings.jsx index ba626485..74442c1d 100644 --- a/src/browser/settings.jsx +++ b/src/browser/settings.jsx @@ -40,6 +40,7 @@ var SettingsPage = React.createClass({ teams: this.state.teams, hideMenuBar: this.state.hideMenuBar, showTrayIcon: this.state.showTrayIcon, + trayIconTheme: this.state.trayIconTheme, disablewebsecurity: this.state.disablewebsecurity, version: settings.version }; @@ -69,6 +70,11 @@ var SettingsPage = React.createClass({ showTrayIcon: this.refs.showTrayIcon.getChecked() }); }, + handleChangeTrayIconTheme: function() { + this.setState({ + trayIconTheme: this.refs.trayIconTheme.getValue() + }); + }, render: function() { var teams_row = ( @@ -84,10 +90,16 @@ var SettingsPage = React.createClass({ options.push(); } - if (process.platform === 'darwin') { + if (process.platform === 'darwin' || process.platform === 'linux') { options.push(); } + if (process.platform === 'linux') { + options.push( + + + ); + } options.push(); var options_row = (options.length > 0) ? ( diff --git a/src/common/settings.js b/src/common/settings.js index 5739c71e..d9561194 100644 --- a/src/common/settings.js +++ b/src/common/settings.js @@ -24,6 +24,7 @@ var loadDefault = function(version) { teams: [], hideMenuBar: false, showTrayIcon: false, + trayIconTheme: '', disablewebsecurity: true, version: 1 }; diff --git a/src/main.js b/src/main.js index c0b33f19..bce357db 100644 --- a/src/main.js +++ b/src/main.js @@ -63,6 +63,13 @@ const trayImages = function() { unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconUnreadTemplate.png')), mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconMentionTemplate.png')) }; + case 'linux': + var resourcesDir = 'resources/linux/' + (config.trayIconTheme || 'light') + '/'; + return { + normal: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconTemplate.png')), + unread: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconUnreadTemplate.png')), + mention: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconMentionTemplate.png')) + }; default: return {}; } @@ -73,7 +80,7 @@ function shouldShowTrayIcon() { if (process.platform === 'win32') { return true; } - if (process.platform === 'darwin' && config.showTrayIcon === true) { + if (['darwin', 'linux'].includes(process.platform) && config.showTrayIcon === true) { return true; } return false; diff --git a/src/resources/linux/dark/MenuIconMentionTemplate.png b/src/resources/linux/dark/MenuIconMentionTemplate.png new file mode 100644 index 00000000..0f1a6134 Binary files /dev/null and b/src/resources/linux/dark/MenuIconMentionTemplate.png differ diff --git a/src/resources/linux/dark/MenuIconTemplate.png b/src/resources/linux/dark/MenuIconTemplate.png new file mode 100644 index 00000000..31e065d8 Binary files /dev/null and b/src/resources/linux/dark/MenuIconTemplate.png differ diff --git a/src/resources/linux/dark/MenuIconUnreadTemplate.png b/src/resources/linux/dark/MenuIconUnreadTemplate.png new file mode 100644 index 00000000..a6f2811a Binary files /dev/null and b/src/resources/linux/dark/MenuIconUnreadTemplate.png differ diff --git a/src/resources/linux/light/MenuIconMentionTemplate.png b/src/resources/linux/light/MenuIconMentionTemplate.png new file mode 100644 index 00000000..69706004 Binary files /dev/null and b/src/resources/linux/light/MenuIconMentionTemplate.png differ diff --git a/src/resources/linux/light/MenuIconTemplate.png b/src/resources/linux/light/MenuIconTemplate.png new file mode 100644 index 00000000..4bb5133c Binary files /dev/null and b/src/resources/linux/light/MenuIconTemplate.png differ diff --git a/src/resources/linux/light/MenuIconUnreadTemplate.png b/src/resources/linux/light/MenuIconUnreadTemplate.png new file mode 100644 index 00000000..ffc7de90 Binary files /dev/null and b/src/resources/linux/light/MenuIconUnreadTemplate.png differ