Create polished demo videos without editing skills. Mac/Windows/Linux
Fix update toast visibility off macOS
webadderall3b05a9cfbb1f
diff --git a/electron/updateToastWindowOptions.test.ts b/electron/updateToastWindowOptions.test.tsnew file mode 100644index 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.tsnew file mode 100644index 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.tsindex 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,