diff --git a/electron/about.test.ts b/electron/about.test.ts index 79fdea4d4..514e34bd2 100644 --- a/electron/about.test.ts +++ b/electron/about.test.ts @@ -68,7 +68,24 @@ describe("PRODUCT_NAME", () => { it("matches the display name macOS reads out of Info.plist", () => { expect(key("CFBundleDisplayName")).toBe(PRODUCT_NAME); - expect(key("CFBundleName")).toBe(PRODUCT_NAME); + }); + + /* + * CFBundleName must NOT be set, and this is the assertion that says why. + * + * Electron resolves its helper apps from CFBundleName, and electron-builder names + * them after `productName` — so they ship as "Openscreen Helper.app". Setting + * CFBundleName to "RoleModel Studio" sent Electron looking for "RoleModel Studio + * Helper.app", which does not exist, and the app aborted before drawing a window: + * + * FATAL:electron_main_delegate_mac.mm:65] Unable to find helper app + * + * That is what made v0.0.1 unopenable. Nothing is lost by leaving it unset: the + * menu bar reads PRODUCT_NAME because main.ts calls app.setName at module scope, + * and everything a person actually reads comes from CFBundleDisplayName above. + */ + it("leaves CFBundleName unset, so Electron can still find its helper apps", () => { + expect(key("CFBundleName")).toBeUndefined(); }); it("leaves the bundle on disk named upstream's, which the cask and the shim resolve", () => { diff --git a/electron/windows.ts b/electron/windows.ts index 1fbd686b0..611f86775 100644 --- a/electron/windows.ts +++ b/electron/windows.ts @@ -545,8 +545,25 @@ export function createStudioWindow(url: string): BrowserWindow { const inset = process.platform === "darwin" ? "72px" : "0px"; win.webContents .insertCSS( - `html, body { background: #141415 !important; } - .op-page__main-header { -webkit-app-region: drag; } + /* + * No `html, body { background: … !important }` here. + * + * It was belt-and-braces against a white flash, and the window's own + * `backgroundColor: "#141415"` above already does that — it is painted + * before the page exists, which is earlier than any injected rule can + * manage anyway. + * + * What it also did was reset the page's background-image. `background` + * is a shorthand, so with !important it wiped the Studio's grid and any + * future page texture, and nothing in a stylesheet can outrank it. + * Injected on dom-ready, it landed after first paint: the grid appeared + * and then vanished, which reads as the page fighting itself. Two days + * were spent looking for the override inside the page, where it was not. + * + * The drag region below is the only thing that genuinely belongs to the + * host: it is about the window frame, and it is inert in a browser. + */ + `.op-page__main-header { -webkit-app-region: drag; } .op-page__main-header button, .op-page__main-header a, .op-page__main-header input { -webkit-app-region: no-drag; }