diff options
author | 2020-04-22 13:44:26 +0530 | |
---|---|---|
committer | 2020-04-22 08:14:26 +0000 | |
commit | d15b045ff108fb7f9ba7c27f0c9442a6e159604a (patch) | |
tree | 15abd6649d98c1a339a7ae565b7927e518796910 /src/lib/Tray.js | |
parent | docs: add mahadevans87 as a contributor (#622) (diff) | |
download | ferdium-app-d15b045ff108fb7f9ba7c27f0c9442a6e159604a.tar.gz ferdium-app-d15b045ff108fb7f9ba7c27f0c9442a6e159604a.tar.zst ferdium-app-d15b045ff108fb7f9ba7c27f0c9442a6e159604a.zip |
Differentiate badge icon/color for indirect notifications (#590)
* feat: Differentiate between indirect and direct notifications
- Windows - Replace the icon used for showing indirect notifications in the taskbar to a blue(#0088cc) color (like slack, google chat etd)
- All Platforms - Replace the red color used for indirect notifications in tabbed view for a service to #0088cc (Blue) color
* Indirect notification icons in tray and tabs
Co-authored-by: Feiko Joosten <feiko_joosten@hotmail.com>
Co-authored-by: Sampath Kumar Krishnan <sampathBlam@users.noreply.github.com>
Diffstat (limited to 'src/lib/Tray.js')
-rw-r--r-- | src/lib/Tray.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/Tray.js b/src/lib/Tray.js index 3700cca27..8928c97bc 100644 --- a/src/lib/Tray.js +++ b/src/lib/Tray.js | |||
@@ -6,6 +6,7 @@ import path from 'path'; | |||
6 | const FILE_EXTENSION = process.platform === 'win32' ? 'ico' : 'png'; | 6 | const FILE_EXTENSION = process.platform === 'win32' ? 'ico' : 'png'; |
7 | const INDICATOR_TRAY_PLAIN = 'tray'; | 7 | const INDICATOR_TRAY_PLAIN = 'tray'; |
8 | const INDICATOR_TRAY_UNREAD = 'tray-unread'; | 8 | const INDICATOR_TRAY_UNREAD = 'tray-unread'; |
9 | const INDICATOR_TRAY_INDIRECT = 'tray-indirect'; | ||
9 | 10 | ||
10 | export default class TrayIcon { | 11 | export default class TrayIcon { |
11 | trayIcon = null; | 12 | trayIcon = null; |
@@ -103,14 +104,23 @@ export default class TrayIcon { | |||
103 | this._refreshIcon(); | 104 | this._refreshIcon(); |
104 | } | 105 | } |
105 | 106 | ||
107 | _getAssetFromIndicator(indicator) { | ||
108 | if (indicator === '•') { | ||
109 | return INDICATOR_TRAY_INDIRECT; | ||
110 | } if (indicator !== 0) { | ||
111 | return INDICATOR_TRAY_UNREAD; | ||
112 | } | ||
113 | return INDICATOR_TRAY_PLAIN; | ||
114 | } | ||
115 | |||
106 | _refreshIcon() { | 116 | _refreshIcon() { |
107 | if (!this.trayIcon) return; | 117 | if (!this.trayIcon) return; |
108 | 118 | ||
109 | this.trayIcon.setImage(this._getAsset('tray', this.indicator !== 0 ? INDICATOR_TRAY_UNREAD : INDICATOR_TRAY_PLAIN)); | 119 | this.trayIcon.setImage(this._getAsset('tray', this._getAssetFromIndicator(this.indicator))); |
110 | 120 | ||
111 | if (process.platform === 'darwin') { | 121 | if (process.platform === 'darwin') { |
112 | this.trayIcon.setPressedImage( | 122 | this.trayIcon.setPressedImage( |
113 | this._getAsset('tray', `${this.indicator !== 0 ? INDICATOR_TRAY_UNREAD : INDICATOR_TRAY_PLAIN}-active`), | 123 | this._getAsset('tray', `${this._getAssetFromIndicator(this.indicator)}-active`), |
114 | ); | 124 | ); |
115 | } | 125 | } |
116 | } | 126 | } |