Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion electron/about.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
21 changes: 19 additions & 2 deletions electron/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
Loading