源码快照 @ 2026-09-02 (source-only, 剔除非源码素材)

This commit is contained in:
agent-radar committed 2026-09-02 01:05:41 +08:00
commit 04bac1f6e2
2200 files changed
+489415

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
const MAX_APP_NAME_LENGTH = 64;
/**
* Apply a branded display name to Electron and every native surface that
* derives from it. The macOS menu-bar label follows the process title, while
* Electron-owned labels follow app.getName(), so both must change before the
* application menu rebuilds.
*
* @param {unknown} requestedName
* @param {{
* fallbackName: string,
* platform: string,
* updateElectronAppName: boolean,
* runtimeProcess: { title: string },
* app: { setName: (name: string) => void },
* applicationMenu: { setAppName: (name: string) => unknown },
* window?: { setTitle: (name: string) => void } | null,
* }} dependencies
*/
export function applyBrandAppName(requestedName, dependencies) {
const requested = requestedName === null ? "" : String(requestedName ?? "").trim();
const appName = requested.slice(0, MAX_APP_NAME_LENGTH) || dependencies.fallbackName;
if (dependencies.platform === "darwin") {
dependencies.runtimeProcess.title = appName;
}
if (dependencies.updateElectronAppName) {
dependencies.app.setName(appName);
}
dependencies.applicationMenu.setAppName(appName);
dependencies.window?.setTitle(appName);
return appName;
}