fix: show badge only for unreads

This commit is contained in:
Oleh Polisan 2024-06-21 23:39:48 +03:00
parent 8bbe16b775
commit cb7363d682
2 changed files with 6 additions and 4 deletions

View file

@ -29,8 +29,10 @@ export function setBadgeCount(count: number) {
lastBadgeCount = count; lastBadgeCount = count;
switch (process.platform) { switch (process.platform) {
case "linux": case "linux":
if (count === -1) count = 0; // commented out lines are temp to be replaced by #686
app.setBadgeCount(count); // if (count === -1) count = 0;
// app.setBadgeCount(count);
break; break;
case "darwin": case "darwin":
if (count === 0) { if (count === 0) {

View file

@ -34,7 +34,7 @@ export async function setTrayIcon(iconName: string) {
if (!Icons.has(iconName)) return; if (!Icons.has(iconName)) return;
// if need to set main icon then check whether there is need of notif badge // 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; var trayImage: NativeImage;
if (isCustomIcon("icon")) { if (isCustomIcon("icon")) {
trayImage = nativeImage.createFromPath(join(ICONS_DIR, "icon_custom.png")); 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"); 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); mainWin.webContents.send(IpcEvents.ADD_BADGE_TO_ICON, trayImage.toDataURL(), badgeSvg);
return; return;
} }