Skip to content

Commit 011b6ac

Browse files
committed
🤖 fix: Cmd+Q now properly quits app on macOS
The menu structure was not following Electron's standard pattern for macOS, causing Cmd+Q to not trigger the quit action. On macOS, the standard pattern is: - App menu: Contains 'quit' (Cmd+Q) - File menu: Contains 'close' (Cmd+W) - Window menu: Contains 'minimize', 'zoom', 'front' (NOT 'close') Previously we had 'close' in the Window menu which may have interfered with Electron's accelerator registration. Now we follow the official Electron documentation pattern, placing 'close' in the File menu on macOS. Fixes #1100
1 parent e9d5a93 commit 011b6ac

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/desktop/main.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,19 @@ function timestamp(): string {
143143

144144
function createMenu() {
145145
const template: MenuItemConstructorOptions[] = [
146+
{
147+
label: "File",
148+
submenu:
149+
process.platform === "darwin"
150+
? [
151+
// On macOS, "Close" (Cmd+W) lives in File menu, not Window menu
152+
{ role: "close" },
153+
]
154+
: [
155+
// On Windows/Linux, Quit (Ctrl+Q) lives in File menu
156+
{ role: "quit" },
157+
],
158+
},
146159
{
147160
label: "Edit",
148161
submenu: [
@@ -182,7 +195,17 @@ function createMenu() {
182195
},
183196
{
184197
label: "Window",
185-
submenu: [{ role: "minimize" }, { role: "close" }],
198+
submenu:
199+
process.platform === "darwin"
200+
? [
201+
// macOS: Standard window management items
202+
// Note: "close" goes in File menu on macOS (see Electron docs)
203+
{ role: "minimize" },
204+
{ role: "zoom" },
205+
{ type: "separator" },
206+
{ role: "front" },
207+
]
208+
: [{ role: "minimize" }, { role: "close" }],
186209
},
187210
];
188211

0 commit comments

Comments
 (0)