diff options
Diffstat (limited to 'src/lib/Tray.js')
-rw-r--r-- | src/lib/Tray.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/Tray.js b/src/lib/Tray.js index 3700cca27..d6d49b0c8 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; |
@@ -54,6 +55,8 @@ export default class TrayIcon { | |||
54 | 55 | ||
55 | this.trayIcon = new Tray(this._getAsset('tray', INDICATOR_TRAY_PLAIN)); | 56 | this.trayIcon = new Tray(this._getAsset('tray', INDICATOR_TRAY_PLAIN)); |
56 | 57 | ||
58 | this.trayIcon.setToolTip('Ferdi'); | ||
59 | |||
57 | this.trayMenu = Menu.buildFromTemplate(this.trayMenuTemplate); | 60 | this.trayMenu = Menu.buildFromTemplate(this.trayMenuTemplate); |
58 | 61 | ||
59 | ipcMain.on('initialAppSettings', (event, appSettings) => { | 62 | ipcMain.on('initialAppSettings', (event, appSettings) => { |
@@ -103,14 +106,23 @@ export default class TrayIcon { | |||
103 | this._refreshIcon(); | 106 | this._refreshIcon(); |
104 | } | 107 | } |
105 | 108 | ||
109 | _getAssetFromIndicator(indicator) { | ||
110 | if (indicator === '•') { | ||
111 | return INDICATOR_TRAY_INDIRECT; | ||
112 | } if (indicator !== 0) { | ||
113 | return INDICATOR_TRAY_UNREAD; | ||
114 | } | ||
115 | return INDICATOR_TRAY_PLAIN; | ||
116 | } | ||
117 | |||
106 | _refreshIcon() { | 118 | _refreshIcon() { |
107 | if (!this.trayIcon) return; | 119 | if (!this.trayIcon) return; |
108 | 120 | ||
109 | this.trayIcon.setImage(this._getAsset('tray', this.indicator !== 0 ? INDICATOR_TRAY_UNREAD : INDICATOR_TRAY_PLAIN)); | 121 | this.trayIcon.setImage(this._getAsset('tray', this._getAssetFromIndicator(this.indicator))); |
110 | 122 | ||
111 | if (process.platform === 'darwin') { | 123 | if (process.platform === 'darwin') { |
112 | this.trayIcon.setPressedImage( | 124 | this.trayIcon.setPressedImage( |
113 | this._getAsset('tray', `${this.indicator !== 0 ? INDICATOR_TRAY_UNREAD : INDICATOR_TRAY_PLAIN}-active`), | 125 | this._getAsset('tray', `${this._getAssetFromIndicator(this.indicator)}-active`), |
114 | ); | 126 | ); |
115 | } | 127 | } |
116 | } | 128 | } |