diff options
Diffstat (limited to 'src/lib/Tray.js')
-rw-r--r-- | src/lib/Tray.js | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lib/Tray.js b/src/lib/Tray.js index 36f0de66d..f37b4eb7b 100644 --- a/src/lib/Tray.js +++ b/src/lib/Tray.js | |||
@@ -3,13 +3,9 @@ import { | |||
3 | } from 'electron'; | 3 | } from 'electron'; |
4 | import path from 'path'; | 4 | import path from 'path'; |
5 | import macosVersion from 'macos-version'; | 5 | import macosVersion from 'macos-version'; |
6 | import { | 6 | import { isMac, isWindows, isLinux } from '../environment'; |
7 | isMac, | ||
8 | isWindows, | ||
9 | isLinux, | ||
10 | } from '../environment'; | ||
11 | 7 | ||
12 | const FILE_EXTENSION = process.platform === 'win32' ? 'ico' : 'png'; | 8 | const FILE_EXTENSION = isWindows ? 'ico' : 'png'; |
13 | const INDICATOR_TRAY_PLAIN = 'tray'; | 9 | const INDICATOR_TRAY_PLAIN = 'tray'; |
14 | const INDICATOR_TRAY_UNREAD = 'tray-unread'; | 10 | const INDICATOR_TRAY_UNREAD = 'tray-unread'; |
15 | const INDICATOR_TRAY_INDIRECT = 'tray-indirect'; | 11 | const INDICATOR_TRAY_INDIRECT = 'tray-indirect'; |
@@ -110,7 +106,7 @@ export default class TrayIcon { | |||
110 | }); | 106 | }); |
111 | } | 107 | } |
112 | 108 | ||
113 | if (process.platform === 'darwin') { | 109 | if (isMac) { |
114 | this.themeChangeSubscriberId = systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', () => { | 110 | this.themeChangeSubscriberId = systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', () => { |
115 | this._refreshIcon(); | 111 | this._refreshIcon(); |
116 | }); | 112 | }); |
@@ -128,7 +124,7 @@ export default class TrayIcon { | |||
128 | this.trayIcon.destroy(); | 124 | this.trayIcon.destroy(); |
129 | this.trayIcon = null; | 125 | this.trayIcon = null; |
130 | 126 | ||
131 | if (process.platform === 'darwin' && this.themeChangeSubscriberId) { | 127 | if (isMac && this.themeChangeSubscriberId) { |
132 | systemPreferences.unsubscribeNotification(this.themeChangeSubscriberId); | 128 | systemPreferences.unsubscribeNotification(this.themeChangeSubscriberId); |
133 | this.themeChangeSubscriberId = null; | 129 | this.themeChangeSubscriberId = null; |
134 | } | 130 | } |
@@ -164,7 +160,7 @@ export default class TrayIcon { | |||
164 | 160 | ||
165 | this.trayIcon.setImage(this._getAsset('tray', this._getAssetFromIndicator(this.indicator))); | 161 | this.trayIcon.setImage(this._getAsset('tray', this._getAssetFromIndicator(this.indicator))); |
166 | 162 | ||
167 | if (process.platform === 'darwin') { | 163 | if (isMac) { |
168 | this.trayIcon.setPressedImage( | 164 | this.trayIcon.setPressedImage( |
169 | this._getAsset('tray', `${this._getAssetFromIndicator(this.indicator)}-active`), | 165 | this._getAsset('tray', `${this._getAssetFromIndicator(this.indicator)}-active`), |
170 | ); | 166 | ); |
@@ -174,7 +170,7 @@ export default class TrayIcon { | |||
174 | _getAsset(type, asset) { | 170 | _getAsset(type, asset) { |
175 | let { platform } = process; | 171 | let { platform } = process; |
176 | 172 | ||
177 | if (platform === 'darwin' && (nativeTheme.shouldUseDarkColors || macosVersion.isGreaterThanOrEqualTo('11'))) { | 173 | if (isMac && (nativeTheme.shouldUseDarkColors || macosVersion.isGreaterThanOrEqualTo('11'))) { |
178 | platform = `${platform}-dark`; | 174 | platform = `${platform}-dark`; |
179 | } | 175 | } |
180 | 176 | ||