Fix update toast visibility off macOS

This commit is contained in:
webadderall
2026-09-03 12:09:30 +10:00
parent fc5a2e614b
commit 6941490cea
3 changed files with 30 additions and 2 deletions
+18
View File
@@ -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",
});
});
});
+8
View File
@@ -0,0 +1,8 @@
export function getUpdateToastWindowAppearance(platform: NodeJS.Platform) {
const transparent = platform === "darwin";
return {
transparent,
backgroundColor: transparent ? "#00000000" : "#101418",
};
}
+4 -2
View File
@@ -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,