fix: correctly load badge count; expose to renderer (#25)

This commit is contained in:
Paul Makles
2025-12-29 18:47:24 +01:00
committed by GitHub
parent cb373b6dc6
commit 6817b554e5
3 changed files with 18 additions and 18 deletions
+4 -2
View File
@@ -1,6 +1,6 @@
import dbus from "@homebridge/dbus-native";
import { NativeImage, app, nativeImage } from "electron";
import { NativeImage, app, ipcMain, nativeImage } from "electron";
import { mainWindow } from "./window";
@@ -21,7 +21,7 @@ export async function setBadgeCount(count: number) {
nativeIcons[count] = nativeImage.createFromDataURL(
await import(
`../../assets/desktop/badges/${Math.min(count, 10)}.ico?asset`
),
).then((asset) => asset.default),
);
mainWindow.setOverlayIcon(
@@ -65,3 +65,5 @@ export async function setBadgeCount(count: number) {
break;
}
}
ipcMain.on("setBadgeCount", (_event, count: number) => setBadgeCount(count));