Fix ⌘Q not quitting on macOS

The Quit item was role:"quit" with no accelerator, so ⌘Q was never
bound. Make it a custom action + accelerator "q" dispatched to
Utils.quit(), which emits before-quit so the existing guard (active
transfers / unsaved editors, native confirm dialog) runs instead of the
OS terminating directly. Handled before the manager-open check so ⌘Q
works with the connection manager open too.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 17:51:29 +02:00
co-authored by Claude Fable 5
parent f86b10335e
commit b2cf000293
2 changed files with 10 additions and 1 deletions
+6
View File
@@ -245,6 +245,12 @@ ApplicationMenu.on("application-menu-clicked", (event) => {
showAbout(); showAbout();
return; return;
} }
if (action === "quit") {
// Utils.quit() emits before-quit -> the guard runs (transfers/unsaved).
// Handled before the manager check so ⌘Q quits even with it open.
Utils.quit();
return;
}
// the manager is modal to the main window — don't drive main behind it // the manager is modal to the main window — don't drive main behind it
if (manager.isOpen()) return; if (manager.isOpen()) return;
rpc.send.menuAction({ action }); rpc.send.menuAction({ action });
+4 -1
View File
@@ -42,7 +42,10 @@ export async function applyApplicationMenu(store: ConnectionStore): Promise<void
{ role: "hideOthers" }, { role: "hideOthers" },
{ role: "showAll" }, { role: "showAll" },
{ type: "separator" }, { type: "separator" },
{ label: t("menu.quit"), role: "quit" }, // Custom action (not role:"quit") + explicit ⌘Q: routes through
// Utils.quit() so the before-quit guard (active transfers / unsaved
// editors) always runs instead of the OS terminating directly.
{ label: t("menu.quit"), action: "quit", accelerator: "q" },
], ],
}, },
{ {