From 626e1e267e06a92bb936f3887db4ef9ee3535727 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 27 Jun 2026 15:44:12 +0200 Subject: [PATCH] fix(desktop): quit on SIGTERM and SIGINT The desktop app ignored termination signals because the tray and embedded express server keep the Electron event loop alive, forcing users to kill -9 on logout/shutdown. Add SIGINT/SIGTERM handlers that set isQuitting before app.quit() so the hide-to-tray close handler doesn't swallow the quit. --- desktop/main.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/desktop/main.js b/desktop/main.js index ca84f4c1f..55a0ea062 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -543,3 +543,14 @@ app.on('window-all-closed', () => { app.quit() } }) + +// Quit on termination signals (DE/systemd shutdown, `kill`). Without an explicit +// handler the app ignores SIGTERM because the tray and express server keep the +// event loop alive — leaving users to `kill -9`. isQuitting must be set first so +// the hide-to-tray close handler doesn't swallow the quit. +for (const signal of ['SIGINT', 'SIGTERM']) { + process.on(signal, () => { + isQuitting = true + app.quit() + }) +}