// Dev-mode Dock tooltip: `electron .` runs the stock Electron.app bundle, whose // CFBundleDisplayName is "Electron" — so hovering the Dock icon says "Electron" // no matter what app.setName() does (macOS reads the bundle, not the runtime // name). Patch the dev bundle's display name to match the packaged brand. // Idempotent; no-op off macOS or when electron isn't installed. Deliberately // does NOT touch the main-process APP_NAME — that one keys the userData path. import { execFileSync } from 'node:child_process' import { existsSync } from 'node:fs' import path from 'node:path' import { fileURLToPath } from 'node:url' const DISPLAY_NAME = 'Digital Assistant' if (process.platform === 'darwin') { const desktopRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..') const plist = path.join(desktopRoot, 'node_modules/electron/dist/Electron.app/Contents/Info.plist') if (existsSync(plist)) { const buddy = '/usr/libexec/PlistBuddy' const read = key => { try { return execFileSync(buddy, ['-c', `Print :${key}`, plist], { encoding: 'utf8' }).trim() } catch { return '' } } const write = (key, value) => execFileSync(buddy, ['-c', `Set :${key} ${value}`, plist], { stdio: 'ignore' }) for (const key of ['CFBundleName', 'CFBundleDisplayName']) { if (read(key) !== DISPLAY_NAME) { write(key, DISPLAY_NAME) } } } }