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;
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) {

View file

@ -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;
}