From da3f79146bfd1f6cfb65361590408ca938b8a4b5 Mon Sep 17 00:00:00 2001 From: talksik Date: Tue, 14 Apr 2026 13:15:01 -0700 Subject: [PATCH] allow multiple dev windows --- js/src/main.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/src/main.ts b/js/src/main.ts index 9c3ed10..2261477 100644 --- a/js/src/main.ts +++ b/js/src/main.ts @@ -25,11 +25,21 @@ if (process.platform === 'darwin' && !app.isPackaged) { app.dock?.setIcon(path.join(__dirname, '../../assets/icon.png')); } +// In dev, `LLINK_PROFILE=foo yarn start` spins up a second instance with an +// isolated userData dir so it can coexist with the default one (separate auth, +// cookies, leveldb locks). +const devProfile = !app.isPackaged ? process.env.LLINK_PROFILE : undefined; +if (devProfile) { + app.setPath('userData', `${app.getPath('userData')}-${devProfile}`); +} + // Single-instance lock: on Windows/Linux, clicking a llink:// URL launches a new // process. The lock makes the losing instance quit and fires `second-instance` on // the primary, so we focus the existing window instead of spawning a duplicate. // macOS uses `open-url` instead and doesn't need this, but the lock is harmless. -if (!app.requestSingleInstanceLock()) { +// Skip the lock when running a named dev profile — those instances are meant to +// run alongside the default one. +if (!devProfile && !app.requestSingleInstanceLock()) { app.quit(); }