From ced074a3a05c1c8eb3bb44070a04b7714e4a2229 Mon Sep 17 00:00:00 2001 From: avi Date: Mon, 5 Oct 2026 17:48:04 -0500 Subject: [PATCH 1/5] fix(single-instance): quit when the lock is lost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit requestSingleInstanceLock() without a quit on failure means the second process falls through to whenReady() and opens a duplicate window (what Avi saw: two Folios from one icon click). Now the loser forwards to the running window (second-instance) and exits. Pairs with the launcher TMPDIR pin — uwsm per-scope /tmp made the singleton socket invisible, so the lock never even failed before. --- src/main/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/index.ts b/src/main/index.ts index e666950..3596ddb 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1423,4 +1423,8 @@ if (app.requestSingleInstanceLock()) { } if (f) openFromArg(f); }); +} else { + // Lost the lock: another Folio is already running. Without this quit the + // second process falls through to whenReady() and opens a duplicate window. + app.quit(); } From 328b24d5a64e7d55bb02b8ebc98cb84a12c5ce81 Mon Sep 17 00:00:00 2001 From: avi Date: Mon, 5 Oct 2026 17:48:04 -0500 Subject: [PATCH 2/5] chore(release): bump to 0.1.15 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f0c51fa..4e45214 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "folio", - "version": "0.1.14", + "version": "0.1.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "folio", - "version": "0.1.14", + "version": "0.1.15", "license": "MIT", "dependencies": { "@tiptap/core": "^2.27.2", diff --git a/package.json b/package.json index 099acf8..85cbb3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "folio", - "version": "0.1.14", + "version": "0.1.15", "description": "A simple, local, open-source desktop writing app.", "productName": "Folio", "author": "Folio Contributors", From aebfa2630883203417801415c0a40699323f9d15 Mon Sep 17 00:00:00 2001 From: avi Date: Mon, 5 Oct 2026 18:11:24 -0500 Subject: [PATCH 3/5] fix(updater): relaunch survives the handoff unit's cgroup sweep v0.1.15 update proved the pipeline end-to-end (download, verify, swap OK) but the app never reopened: the handoff runs in a systemd transient unit whose default KillMode=control-group sweeps the process tree when the script exits, killing the backgrounded relaunch before Electron started. Two fixes: start the unit with KillMode=process, and setsid the relaunch (nohup fallback) so it detaches from the unit session entirely. --- src/main/index.ts | 5 +++++ src/main/update.ts | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/index.ts b/src/main/index.ts index 3596ddb..c9557a1 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1354,6 +1354,11 @@ handleIpc("folio:performUpdate", async () => { execFileSync("systemd-run", [ "--user", "--quiet", "--collect", `--description=Folio updater handoff`, + // Default KillMode=control-group means the unit's cgroup is swept + // when the script exits — that killed the backgrounded relaunch + // before Electron got to start (v0.1.15 update: swap OK, app died). + // KillMode=process lets the script exit while its child app lives. + "--property=KillMode=process", "/bin/sh", script, ], { timeout: 10_000, stdio: "ignore" }); handedOff = true; diff --git a/src/main/update.ts b/src/main/update.ts index 738245b..9493643 100644 --- a/src/main/update.ts +++ b/src/main/update.ts @@ -224,7 +224,14 @@ export function buildInstallerScript(spec: InstallerSpec): string { ' rm -rf "$NEW"', "fi", 'say "relaunching"', - '"$RELAUNCH" >/dev/null 2>&1 &', + // Detach fully: setsid moves the relaunch into its own session so it + // survives this script's exit and any cgroup sweep of the transient + // unit (systemd KillMode). Fallback chain for missing setsid. + 'if command -v setsid >/dev/null 2>&1; then', + ' setsid "$RELAUNCH" >/dev/null 2>&1 < /dev/null &', + 'else', + ' nohup "$RELAUNCH" >/dev/null 2>&1 < /dev/null &', + "fi", "", ].join("\n"); } From 6c8b82940a0a7cab181c21f96c26af21bcd652c6 Mon Sep 17 00:00:00 2001 From: avi Date: Mon, 5 Oct 2026 18:11:24 -0500 Subject: [PATCH 4/5] chore(release): bump to 0.1.16 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e45214..beef7ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "folio", - "version": "0.1.15", + "version": "0.1.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "folio", - "version": "0.1.15", + "version": "0.1.16", "license": "MIT", "dependencies": { "@tiptap/core": "^2.27.2", diff --git a/package.json b/package.json index 85cbb3f..88f1ca5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "folio", - "version": "0.1.15", + "version": "0.1.16", "description": "A simple, local, open-source desktop writing app.", "productName": "Folio", "author": "Folio Contributors", From 67ca9cbb768c1b73c6a2bce294ce82372206bbaf Mon Sep 17 00:00:00 2001 From: avi Date: Mon, 5 Oct 2026 19:03:41 -0500 Subject: [PATCH 5/5] chore(release): bump to 0.1.17 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index beef7ee..6b4b766 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "folio", - "version": "0.1.16", + "version": "0.1.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "folio", - "version": "0.1.16", + "version": "0.1.17", "license": "MIT", "dependencies": { "@tiptap/core": "^2.27.2", diff --git a/package.json b/package.json index 88f1ca5..3ffd369 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "folio", - "version": "0.1.16", + "version": "0.1.17", "description": "A simple, local, open-source desktop writing app.", "productName": "Folio", "author": "Folio Contributors",