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
15 changes: 14 additions & 1 deletion electron-builder.json5
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,20 @@
// `app.setName()` in electron/main.ts sets the same string for an unpackaged
// run, where there is no Info.plist to read.
"CFBundleDisplayName": "RoleModel Studio",
"CFBundleName": "RoleModel Studio",
// CFBundleName is deliberately NOT overridden.
//
// Electron resolves its helper apps from CFBundleName. electron-builder names
// them after `productName`, so they ship as "Openscreen Helper.app" — and
// setting CFBundleName to "RoleModel Studio" made Electron look for
// "RoleModel Studio Helper.app", find nothing, and abort 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 alone:
// the menu bar reads "RoleModel Studio" because electron/main.ts calls
// `app.setName(PRODUCT_NAME)` at module scope, and Finder, the Dock, the
// About panel and every permission prompt read CFBundleDisplayName above.
// These are quoted verbatim in the macOS permission dialogs, so they say the
// name of the app the person is being asked about.
"NSAudioCaptureUsageDescription": "RoleModel Studio needs audio capture permission to record system audio.",
Expand Down
7 changes: 7 additions & 0 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,13 @@ if (!cliCommand) {

app.on("activate", () => {
if (cliCommand) return;
// `activate` can arrive before `whenReady`, the same way `open-file` can — and
// the window this ends up building measures the primary display, which throws
// "The 'screen' module can't be used before the app 'ready' event" and takes the
// main process with it. Launching the binary directly is enough to see it.
// Nothing is lost by ignoring an early activate: whenReady creates the window
// anyway, and macOS re-sends activate when the dock icon is clicked.
if (!app.isReady()) return;
// On macOS, re-open a window when the dock icon is clicked and none are open.
const hasVisibleWindow = BrowserWindow.getAllWindows().some((window) => {
if (window.isDestroyed() || !window.isVisible()) {
Expand Down
Loading