From cb7363d68218ed9f7a5b6f04cba51169f910a037 Mon Sep 17 00:00:00 2001 From: Oleh Polisan Date: Fri, 21 Jun 2024 23:39:48 +0300 Subject: [PATCH] fix: show badge only for unreads --- src/main/appBadge.ts | 6 ++++-- src/main/tray.ts | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/appBadge.ts b/src/main/appBadge.ts index 9cca2c3..37bd8eb 100644 --- a/src/main/appBadge.ts +++ b/src/main/appBadge.ts @@ -29,8 +29,10 @@ export function setBadgeCount(count: number) { lastBadgeCount = count; switch (process.platform) { case "linux": - if (count === -1) count = 0; - app.setBadgeCount(count); + // commented out lines are temp to be replaced by #686 + // if (count === -1) count = 0; + // app.setBadgeCount(count); + break; case "darwin": if (count === 0) { diff --git a/src/main/tray.ts b/src/main/tray.ts index be00ef2..6e66e0a 100644 --- a/src/main/tray.ts +++ b/src/main/tray.ts @@ -34,7 +34,7 @@ export async function setTrayIcon(iconName: string) { if (!Icons.has(iconName)) return; // if need to set main icon then check whether there is need of notif badge - if (iconName === "icon" && lastBadgeCount && lastBadgeCount > 0) { + if (iconName === "icon" && lastBadgeCount === -1) { var trayImage: NativeImage; if (isCustomIcon("icon")) { trayImage = nativeImage.createFromPath(join(ICONS_DIR, "icon_custom.png")); @@ -43,7 +43,7 @@ export async function setTrayIcon(iconName: string) { } const badgeSvg = readFileSync(join(BADGE_DIR, `badge.svg`), "utf8"); - // and send IPC call to renderer to add to image + // and send IPC call to renderer to add badge to icon mainWin.webContents.send(IpcEvents.ADD_BADGE_TO_ICON, trayImage.toDataURL(), badgeSvg); return; }