@@ -17,25 +17,14 @@ const { autoUpdater } = require('electron-updater');
1717const { updateElectronApp } = require ( 'update-electron-app' ) ;
1818
1919log . initialize ( ) ;
20+
2021// Tray Icons
21- const idleIcon = path . resolve (
22- `${ __dirname } /../../assets/images/tray-idleTemplate.png` ,
23- ) ;
24- const idleUpdateAvailableIcon = path . resolve (
25- `${ __dirname } /../../assets/images/tray-idle-update.png` ,
26- ) ;
27- const idleAlternateIcon = path . resolve (
28- `${ __dirname } /../../assets/images/tray-idle-white.png` ,
29- ) ;
30- const idleAlternateUpdateAvailableIcon = path . resolve (
31- `${ __dirname } /../../assets/images/tray-idle-white-update.png` ,
32- ) ;
33- const activeIcon = path . resolve (
34- `${ __dirname } /../../assets/images/tray-active.png` ,
35- ) ;
36- const activeUpdateAvailableIcon = path . resolve (
37- `${ __dirname } /../../assets/images/tray-active-update.png` ,
38- ) ;
22+ const idleIcon = getIconPath ( 'tray-idleTemplate.png' ) ;
23+ const idleUpdateIcon = getIconPath ( 'tray-idle-update.png' ) ;
24+ const idleAlternateIcon = getIconPath ( 'tray-idle-white.png' ) ;
25+ const idleAlternateUpdateIcon = getIconPath ( 'tray-idle-white-update.png' ) ;
26+ const activeIcon = getIconPath ( 'tray-active.png' ) ;
27+ const activeUpdateIcon = getIconPath ( 'tray-active-update.png' ) ;
3928
4029const browserWindowOpts = {
4130 width : 500 ,
@@ -192,9 +181,7 @@ app.whenReady().then(async () => {
192181 ipc . on ( 'gitify:icon-active' , ( ) => {
193182 if ( ! mb . tray . isDestroyed ( ) ) {
194183 mb . tray . setImage (
195- updateAvailableMenuItem . visible
196- ? activeUpdateAvailableIcon
197- : activeIcon ,
184+ updateAvailableMenuItem . visible ? activeUpdateIcon : activeIcon ,
198185 ) ;
199186 }
200187 } ) ;
@@ -204,12 +191,12 @@ app.whenReady().then(async () => {
204191 if ( shouldUseAlternateIdleIcon ) {
205192 mb . tray . setImage (
206193 updateAvailableMenuItem . visible
207- ? idleAlternateUpdateAvailableIcon
194+ ? idleAlternateUpdateIcon
208195 : idleAlternateIcon ,
209196 ) ;
210197 } else {
211198 mb . tray . setImage (
212- updateAvailableMenuItem . visible ? idleUpdateAvailableIcon : idleIcon ,
199+ updateAvailableMenuItem . visible ? idleUpdateIcon : idleIcon ,
213200 ) ;
214201 }
215202 }
@@ -308,3 +295,7 @@ function resetApp() {
308295 mb . app . quit ( ) ;
309296 }
310297}
298+
299+ function getIconPath ( iconName ) {
300+ return path . resolve ( __dirname , '../../assets/images' , iconName ) ;
301+ }
0 commit comments