Fix unread count taskbar badge for Windows

This commit is contained in:
ayumi-signal 2024-03-08 13:35:09 -08:00 committed by GitHub
parent c11b8fb5e3
commit 39fbf6b0bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 69 additions and 0 deletions

26
ts/util/unreadIcon.ts Normal file
View file

@ -0,0 +1,26 @@
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { join } from 'path';
import type { NativeImage } from 'electron';
import { nativeImage } from 'electron';
export function getUnreadIcon(unreadCount: number): NativeImage {
const filename =
unreadCount > 9 ? '9-plus.png' : `${String(unreadCount)}.png`;
const path = join(__dirname, '..', '..', 'images', 'unread-icon', filename);
// if path does not exist, this returns an empty NativeImage
return nativeImage.createFromPath(path);
}
export function getMarkedUnreadIcon(): NativeImage {
const path = join(
__dirname,
'..',
'..',
'images',
'unread-icon',
'marked-unread.png'
);
return nativeImage.createFromPath(path);
}