diff --git a/electron/main.ts b/electron/main.ts index 7bd85c8..6278cf9 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -161,7 +161,7 @@ function openMonitoredApps() { function createTray() { const trayIcon = nativeImage.createFromPath( - path.join(process.env.VITE_PUBLIC!, "trayIconTemplate.png"), + path.join(process.env.VITE_PUBLIC!, "trayIcon.png"), ); tray = new Tray(trayIcon); const contextMenu = Menu.buildFromTemplate([ diff --git a/electron/watchers/wakatime.ts b/electron/watchers/wakatime.ts index d97993c..f40d9e3 100644 --- a/electron/watchers/wakatime.ts +++ b/electron/watchers/wakatime.ts @@ -198,11 +198,50 @@ export class Wakatime { ); this.tray?.displayBalloon({ icon: nativeImage.createFromPath( - path.join(process.env.VITE_PUBLIC!, "trayIconTemplate.png"), + path.join(process.env.VITE_PUBLIC!, "trayIcon.png"), ), title: "WakaTime Error", content: `Error when running wakatime-cli: ${err}`, }); + if (`${err}`.includes("ENOENT")) { + this.tray?.setImage( + nativeImage.createFromPath( + path.join(process.env.VITE_PUBLIC!, "trayIconRed.png"), + ), + ); + if (Notification.isSupported()) { + const notification = new Notification({ + title: "WakaTime Error", + body: "Unable to execute WakaTime cli. Please make sure WakaTime is not being blocked by AV software.", + icon: nativeImage.createFromPath( + path.join(process.env.VITE_PUBLIC!, "trayIconRed.png"), + ), + }); + notification.show(); + } + } else if (`${err}`.includes("EPERM")) { + this.tray?.setImage( + nativeImage.createFromPath( + path.join(process.env.VITE_PUBLIC!, "trayIconRed.png"), + ), + ); + if (Notification.isSupported()) { + const notification = new Notification({ + title: "WakaTime Error", + body: "Microsoft Defender is blocking WakaTime. Please allow WakaTime to run so it can upload code stats to your dashboard.", + icon: nativeImage.createFromPath( + path.join(process.env.VITE_PUBLIC!, "trayIconRed.png"), + ), + }); + notification.show(); + } + } + } else { + this.tray?.setImage( + nativeImage.createFromPath( + path.join(process.env.VITE_PUBLIC!, "trayIcon.png"), + ), + ); } if (output) { Logging.instance().log( diff --git a/public/trayIconTemplate.png b/public/trayIcon.png similarity index 100% rename from public/trayIconTemplate.png rename to public/trayIcon.png diff --git a/public/trayIconTemplate@2x.png b/public/trayIcon@2x.png similarity index 100% rename from public/trayIconTemplate@2x.png rename to public/trayIcon@2x.png diff --git a/public/trayIconTemplate@3x.png b/public/trayIcon@3x.png similarity index 100% rename from public/trayIconTemplate@3x.png rename to public/trayIcon@3x.png diff --git a/public/trayIconRed.png b/public/trayIconRed.png new file mode 100644 index 0000000..fad860b Binary files /dev/null and b/public/trayIconRed.png differ diff --git a/public/trayIconRed@2x.png b/public/trayIconRed@2x.png new file mode 100644 index 0000000..b6f90fb Binary files /dev/null and b/public/trayIconRed@2x.png differ diff --git a/public/trayIconRed@3x.png b/public/trayIconRed@3x.png new file mode 100644 index 0000000..3918b73 Binary files /dev/null and b/public/trayIconRed@3x.png differ