From fc02656ba31dffe1ef04f7937ec6b18d318edded Mon Sep 17 00:00:00 2001 From: Jiayuan Zhang Date: Fri, 17 Apr 2026 01:53:05 +0800 Subject: [PATCH] chore(desktop): DESKTOP_APP_SUFFIX env for parallel-worktree dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dev Electron uses a single userData path ("Multica Canary") derived from the app name, which also locates the single-instance lock. Two worktrees running dev simultaneously fight for that lock — the second `app.quit()`s silently before opening a window. DESKTOP_APP_SUFFIX appends to the app name + userData path so each worktree can claim its own lock: DESKTOP_APP_SUFFIX=foo → "Multica Canary foo" Default (no env var) keeps behavior unchanged. Complements the existing DESKTOP_RENDERER_PORT env from #1210 so a full "run a second dev Electron" setup looks like: DESKTOP_RENDERER_PORT=15173 DESKTOP_APP_SUFFIX=foo pnpm dev:desktop --- apps/desktop/src/main/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/main/index.ts b/apps/desktop/src/main/index.ts index f093481af..9ca5e8307 100644 --- a/apps/desktop/src/main/index.ts +++ b/apps/desktop/src/main/index.ts @@ -109,7 +109,14 @@ function createWindow(): void { // is derived from the userData path. (Same approach VS Code uses for // Stable / Insiders coexistence.) -const DEV_APP_NAME = "Multica Canary"; +// DESKTOP_APP_SUFFIX lets parallel worktrees run dev Electron side-by-side +// without fighting for the shared single-instance lock. The suffix is +// appended to the app name + userData path, so each worktree gets its own +// lock file. Default (no env var) keeps behavior unchanged — the common +// single-worktree case still lands at "Multica Canary". +const DEV_APP_NAME = process.env.DESKTOP_APP_SUFFIX + ? `Multica Canary ${process.env.DESKTOP_APP_SUFFIX}` + : "Multica Canary"; if (is.dev) { app.setName(DEV_APP_NAME);