allow multiple dev windows

This commit is contained in:
talksik
2026-04-14 13:15:01 -07:00
parent 3f5d55769c
commit da3f79146b
+11 -1
View File
@@ -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();
}