aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/Tray.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Tray.js')
-rw-r--r--src/lib/Tray.js14
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';
6const FILE_EXTENSION = process.platform === 'win32' ? 'ico' : 'png'; 6const FILE_EXTENSION = process.platform === 'win32' ? 'ico' : 'png';
7const INDICATOR_TRAY_PLAIN = 'tray'; 7const INDICATOR_TRAY_PLAIN = 'tray';
8const INDICATOR_TRAY_UNREAD = 'tray-unread'; 8const INDICATOR_TRAY_UNREAD = 'tray-unread';
9const INDICATOR_TRAY_INDIRECT = 'tray-indirect';
9 10
10export default class TrayIcon { 11export 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 }