From 79b9ac896ad789a27215eb1aded2438fbab3281e Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Mon, 14 Jul 2025 13:11:57 +0100 Subject: [PATCH] lint --- src/ipc.ts | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/ipc.ts b/src/ipc.ts index 7577132078..2f396db310 100644 --- a/src/ipc.ts +++ b/src/ipc.ts @@ -12,23 +12,29 @@ import { randomArray } from "./utils.js"; import { getDisplayMediaCallback, setDisplayMediaCallback } from "./displayMediaCallback.js"; import Store, { clearDataAndRelaunch } from "./store.js"; -ipcMain.on("setBadgeCount", function (_ev: IpcMainEvent, count: number, imageBuffer?: Buffer, imageBufferDescription?: string): void { - if (process.platform !== "win32") { - // only set badgeCount on Mac/Linux, the docs say that only those platforms support it but turns out Electron - // has some Windows support too, and in some Windows environments this leads to two badges rendering atop - // each other. See https://github.com/vector-im/element-web/issues/16942 - app.badgeCount = count; - } else { - if (imageBuffer && imageBufferDescription !== undefined) { - global.mainWindow?.setOverlayIcon(nativeImage.createFromBuffer(Buffer.from(imageBuffer)), imageBufferDescription); +ipcMain.on( + "setBadgeCount", + function (_ev: IpcMainEvent, count: number, imageBuffer?: Buffer, imageBufferDescription?: string): void { + if (process.platform !== "win32") { + // only set badgeCount on Mac/Linux, the docs say that only those platforms support it but turns out Electron + // has some Windows support too, and in some Windows environments this leads to two badges rendering atop + // each other. See https://github.com/vector-im/element-web/issues/16942 + app.badgeCount = count; } else { - global.mainWindow?.setOverlayIcon(null, ""); + if (imageBuffer && imageBufferDescription !== undefined) { + global.mainWindow?.setOverlayIcon( + nativeImage.createFromBuffer(Buffer.from(imageBuffer)), + imageBufferDescription, + ); + } else { + global.mainWindow?.setOverlayIcon(null, ""); + } } - } - if (count === 0) { - global.mainWindow?.flashFrame(false); - } -}); + if (count === 0) { + global.mainWindow?.flashFrame(false); + } + }, +); let focusHandlerAttached = false; ipcMain.on("loudNotification", function (): void {