allow multiple dev windows
This commit is contained in:
+11
-1
@@ -25,11 +25,21 @@ if (process.platform === 'darwin' && !app.isPackaged) {
|
|||||||
app.dock?.setIcon(path.join(__dirname, '../../assets/icon.png'));
|
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
|
// 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
|
// 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.
|
// 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.
|
// 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();
|
app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user