From 6941490ceaf8feff367e7c2c522a120434605283 Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Wed, 2 Sep 2026 21:24:38 +1000 Subject: [PATCH] Fix update toast visibility off macOS --- electron/updateToastWindowOptions.test.ts | 18 ++++++++++++++++++ electron/updateToastWindowOptions.ts | 8 ++++++++ electron/windows.ts | 6 ++++-- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 electron/updateToastWindowOptions.test.ts create mode 100644 electron/updateToastWindowOptions.ts diff --git a/electron/updateToastWindowOptions.test.ts b/electron/updateToastWindowOptions.test.ts new file mode 100644 index 00000000..64934a84 --- /dev/null +++ b/electron/updateToastWindowOptions.test.ts @@ -0,0 +1,18 @@ +import { describe, expect, it } from "vitest"; +import { getUpdateToastWindowAppearance } from "./updateToastWindowOptions"; + +describe("update toast window appearance", () => { + it("uses native transparency on macOS", () => { + expect(getUpdateToastWindowAppearance("darwin")).toEqual({ + transparent: true, + backgroundColor: "#00000000", + }); + }); + + it.each(["win32", "linux"] as const)("uses a visible opaque fallback on %s", (platform) => { + expect(getUpdateToastWindowAppearance(platform)).toEqual({ + transparent: false, + backgroundColor: "#101418", + }); + }); +}); diff --git a/electron/updateToastWindowOptions.ts b/electron/updateToastWindowOptions.ts new file mode 100644 index 00000000..b2253f20 --- /dev/null +++ b/electron/updateToastWindowOptions.ts @@ -0,0 +1,8 @@ +export function getUpdateToastWindowAppearance(platform: NodeJS.Platform) { + const transparent = platform === "darwin"; + + return { + transparent, + backgroundColor: transparent ? "#00000000" : "#101418", + }; +} diff --git a/electron/windows.ts b/electron/windows.ts index 47e90b8f..7579beaf 100644 --- a/electron/windows.ts +++ b/electron/windows.ts @@ -12,6 +12,7 @@ import { } from "./hudOverlayBounds"; import { getHudOverlayTaskbarOptions } from "./hudOverlayWindowOptions"; import { getPackagedRendererBaseUrl } from "./rendererServer"; +import { getUpdateToastWindowAppearance } from "./updateToastWindowOptions"; const electronWindowsDir = path.dirname(fileURLToPath(import.meta.url)); const nodeRequire = createRequire(import.meta.url); @@ -689,6 +690,7 @@ export function setHudOverlayRecordingActive(recording: boolean): void { export function createUpdateToastWindow(): BrowserWindow { const initialBounds = getUpdateToastBounds(); + const appearance = getUpdateToastWindowAppearance(process.platform); const win = new BrowserWindow({ width: initialBounds.width, @@ -696,14 +698,14 @@ export function createUpdateToastWindow(): BrowserWindow { x: initialBounds.x, y: initialBounds.y, frame: false, - transparent: true, + transparent: appearance.transparent, resizable: false, alwaysOnTop: true, skipTaskbar: true, hasShadow: false, show: false, focusable: true, - backgroundColor: "#00000000", + backgroundColor: appearance.backgroundColor, webPreferences: { preload: path.join(electronWindowsDir, "preload.mjs"), nodeIntegration: false,