From 1d29cc2c9ea1225b1a6b431b0f2cef502391d066 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Wed, 18 Dec 2024 17:14:32 +0100 Subject: [PATCH] Use toast notification because bubble is broken --- electron/main.ts | 2 +- electron/watchers/wakatime.ts | 41 +++++++++++++++++- public/{trayIconTemplate.png => trayIcon.png} | Bin ...rayIconTemplate@2x.png => trayIcon@2x.png} | Bin ...rayIconTemplate@3x.png => trayIcon@3x.png} | Bin public/trayIconRed.png | Bin 0 -> 2093 bytes public/trayIconRed@2x.png | Bin 0 -> 3350 bytes public/trayIconRed@3x.png | Bin 0 -> 2146 bytes 8 files changed, 41 insertions(+), 2 deletions(-) rename public/{trayIconTemplate.png => trayIcon.png} (100%) rename public/{trayIconTemplate@2x.png => trayIcon@2x.png} (100%) rename public/{trayIconTemplate@3x.png => trayIcon@3x.png} (100%) create mode 100644 public/trayIconRed.png create mode 100644 public/trayIconRed@2x.png create mode 100644 public/trayIconRed@3x.png 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 0000000000000000000000000000000000000000..fad860be233dafbfe7e1886abc94a85e285cca03 GIT binary patch literal 2093 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|mZe5`ruq6Z zXaU(A46KYo49p-UK*+!-#lQ+?Gcb5DO2gSfjD`$MKyf7?j%v?jV1cTs0n#Ag0mMMv z5ZW;%KPgoqAS1sdzc?emK*8Br!N|bSL_s4wGcP5-yjYWgfq4NV!p;RuaPtHfFeBI? zgTDuHdlpi<;HsXMd|v6mX?IbD3=a&{GrvjBL<8T6g z2f)Jw=w%y_Z>%CgX6BTF!o|+q$Oi016hTA)K{P~Q(||09uED=3GZh#oU>gjf79fiu zsRsw4l}l<-W?5>ATTy;4II0Q~i;7c0{}p`)=IG)K zbcm%B++2iKBugR2dSZqW)L2jm;WZXXE2^A=*$$jhT^JS6R zoDI4G3-0=*r`P14G`nDMGVfXS```EW%$IcHTN|RZP`>GSp0(wbAA?@Ft}w!13=Tvy!R)HH3~ z2M>N+ zaNm57dX%L99Hkb=vVYai&SFLHjz6|7KKf{O?m2m<&czp&8*Y&=iM_mRL)xnq&og3r zj0U%EYRz4Su6a;H3o=}Sc}=SDxWi`3W?5Mp}y;tBU3n_O0A z8O@J(x-a)!s37|JGzG1zrKdL~-N=3L$3baxrQ6Tm(q%J}zvZvhVzP9&d?rdar?m9v z>#3i1ojxpoWou7ynM^ucA=j7RlPCA4{JVWS+F;`4yU$s>EMW~I@{(iG(-U0QU%0um!T4^rRR4C1^QzoOS=g@b?OqaC#j1C5dPC+upW{l0TUM%9 zEqLFr$+A^3*P>30ZwJq#`U$5^x&mLPJzza}TVra?t=FG>&1Bo(m`m|yNW5*E<=Z=P zt=j)3B0J6Eb^d)Zc`IbYyu|lmQm^J*-yaDf7Gi-b4(6!;{kxif)(bLt>Wt~$(69AJ}$GHFi literal 0 HcmV?d00001 diff --git a/public/trayIconRed@2x.png b/public/trayIconRed@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..b6f90fbd405a9173c49aa5e80596e3d4034a5a29 GIT binary patch literal 3350 zcmai02|Sef8-K?+M%Gn`HWOBI%;B0bJ7f;WD4WGH61m3C#2n^e3Y#kuQrVPh9b2dr zIolMC6gm(kBuufXmd&+9;Xi|-e|x<1`MuBcKJWAWKF{}g-}m>KWS8$86d;-q000z7 zjzm|Hg^CwgMs()v+czmPAdag89w=_v@LF_HKp~TYot*(gkq-u>K`MZxI7RdWK$?K` zq7ML0AgxcnD+mclh~he;wKItZNG<0?iLCf=6fF^Y$>M^T0TieUmC0pts7w}=K!BPe zkm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N4{cz9San{o?)yP02i> literal 0 HcmV?d00001 diff --git a/public/trayIconRed@3x.png b/public/trayIconRed@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..3918b737d9b948b30ec1ad474ced722ad485845b GIT binary patch literal 2146 zcmaJ?c~nzZ8V|^!$WrZ;f-oYF2mx)#{)B`?4GDpuK^np$%1B5aBw`kmr-`6-LAEH0 zAZn>7SXq?KpimW*IWwprixxcWQblD^p`t8~#Bp9M*#6=4opay4_dCDe_x--*oSPmT zvkj(-1i-1EEv9Ly{f>2DcA_fAuGGQFVhlJu? z+nXRd3bgF*vPEiLg;9`WmfLD2j(*AO?z)${Fb2YU|N}RLnq! zgFFIH$$})(fCLp3k`N>iCB%!UV)UBT09{K%9LOM82xw*71hMbLNJR0~2 zf#VtI-$h06f&rF71py!q^b`?DM8J!RBZ8op7YPfH2t*2=K*STtoF+7Xlsw)i$8z;tp^%c{wL&GHh$G--GGksJ(Q23v z{UPJCXtiLM62kK#wPJ@#g!ChJ`8*k^-CqYX0uePdwnDT+2FYPAn}J3wII&br^W~5^ zEVdVwNc3YO3uKZxWIuv8hskD931q78JeMn1!$P?Tn&(RY;ClZhm&Q^-LRg^^C=}b~ zyB91`zzVfQp#)g0kKF=1!liPtLZe<`Ebp9JNG06~i8(5T4ER_dn)EXo*i2v2Dv;$( zAp071fZk+ZkP4E?O!g{@H^>Chb6oLfa-ZWOdHx?R9ub2#Huq1>o;M*AWITQvUF7m< z_#rtm@hW7rS0B>8LZQssxooCD+xzm=MoDP6ZOXkH*U~Y$osV4xAFSoZq&3jKxwt5N za9`wNY=$j1Y>Q5S_7vE>i!QuU?Wi>SMqpbe$^zA9-1;F8c9&<`-UuGWGQ8xbnS~H>P`8Wu>Lf4ry-V*7viN&b@toc|$|7#rDgV zT66Xly!-DWiHYn7kMvtHK|*0cc3xgy(E5O!lP7(goSX^*Z=N=As5-m$bk|C^XxGM$ zp*xQ>N~_Igaa~*Lk6BIyqaUB=uP81l8Ci3#A~iQR_jG$Z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