Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use toast notification because bubble is broken #88

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]
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/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading