Skip to content

Commit

Permalink
Use toast notification because bubble is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhamlett committed Dec 18, 2024
1 parent 6ec921e commit 1d29cc2
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
41 changes: 40 additions & 1 deletion electron/watchers/wakatime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added public/trayIconRed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/trayIconRed@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/trayIconRed@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1d29cc2

Please sign in to comment.