feat(audit): Batch 20 — Windows/main-process (UI23, W12, W15, L131)
UI23: cookie sign-in + PO-token windows open with the app's resolved theme background (passed from the IPC layer), no more white flash. W12: multi-resolution fallback tray icon (16/24/32/48 via addRepresentation dataURL, embedded in trayFallbackIcons.ts); decode + scale factors verified in an Electron probe. W15: hardwareAcceleration setting (default false = software rendering); index.ts gates disableHardwareAcceleration on it after the portable redirect; Appearance card switch with restart note; boot path verified. L131: resolved by-design — clearing the queue acknowledges failures; flashFrame (W10) covers attention, Diagnostics persists the record. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+13
-14
@@ -6,16 +6,7 @@
|
||||
*/
|
||||
import { app, Tray, Menu, nativeImage, type BrowserWindow } from 'electron'
|
||||
import { getAppIconPath } from './binaries'
|
||||
|
||||
// Fallback tray glyph (32×32 teal disc + white download arrow) used when no
|
||||
// build/icon.ico is present. Without this the tray is skipped (an empty image
|
||||
// makes an invisible/unclickable Windows tray entry), which would strand a
|
||||
// minimized-to-tray window with no way back. Embedded as base64 so it needs no
|
||||
// asset-bundling step.
|
||||
const FALLBACK_TRAY_PNG =
|
||||
'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAl0lEQVR4nO3TQQ6AIAxEUU7giV17bd0i' +
|
||||
'aaDTmdqY0ISl/peirf11jvO6+/N5cHXKwlIIG6cQqngIoY5DiKy4C4G8aBwJohSArpIBmIgNKAWgDys' +
|
||||
'AL8QGlANmCHZc8dUW1HEYEEFA6/d+B6q4CVAhwnHkb2DiUwCDkMRRBHpccQsRnXB8RLCAULxHMAAqbm0j5b4VoPRg1jzWxpzrS/JA7QAAAABJRU5ErkJggg=='
|
||||
import { FALLBACK_TRAY_PNGS } from './trayFallbackIcons'
|
||||
|
||||
let tray: Tray | null = null
|
||||
// True once the user has chosen to really quit (tray menu, or app.quit from the
|
||||
@@ -41,11 +32,19 @@ function show(getWindow: () => BrowserWindow | null): void {
|
||||
/** Create the tray icon + menu once. No-op if it already exists or the icon is missing. */
|
||||
export function createTray(getWindow: () => BrowserWindow | null): void {
|
||||
if (tray) return
|
||||
// Prefer the real app icon; fall back to the embedded glyph when no icon.ico
|
||||
// ships, so minimize-to-tray always has a tray to restore from.
|
||||
// Prefer the real app icon; fall back to the embedded multi-resolution glyph
|
||||
// when no icon.ico ships, so minimize-to-tray always has a tray to restore
|
||||
// from — and stays crisp at 150%/200% DPI (W12). Without any icon the tray is
|
||||
// skipped (an empty image makes an invisible/unclickable Windows tray entry),
|
||||
// which would strand a minimized-to-tray window with no way back.
|
||||
let icon = nativeImage.createFromPath(getAppIconPath())
|
||||
if (icon.isEmpty())
|
||||
icon = nativeImage.createFromDataURL(`data:image/png;base64,${FALLBACK_TRAY_PNG}`)
|
||||
if (icon.isEmpty()) {
|
||||
icon = nativeImage.createEmpty()
|
||||
for (const [scaleFactor, b64] of FALLBACK_TRAY_PNGS) {
|
||||
// dataURL (not `buffer`) so the PNG is decoded — `buffer` is raw bitmap data.
|
||||
icon.addRepresentation({ scaleFactor, dataURL: `data:image/png;base64,${b64}` })
|
||||
}
|
||||
}
|
||||
if (icon.isEmpty()) return
|
||||
|
||||
tray = new Tray(icon)
|
||||
|
||||
Reference in New Issue
Block a user