Skip to content

Commit 5d5e465

Browse files
authored
fix(desktop): expose About and Check for Updates in Help menu on Windows/Linux (#888)
On macOS these items live in the application menu by platform convention, but Windows and Linux have no app menu, leaving users with no way to view the version or trigger an update check. Add them to the Help menu on non-darwin platforms. Refs #784
1 parent b1a3065 commit 5d5e465

1 file changed

Lines changed: 55 additions & 12 deletions

File tree

apps/desktop/main/index.ts

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,27 @@ function triggerUpdateCheck(): void {
505505
});
506506
}
507507

508+
function showAboutDialog(): void {
509+
const version = app.getVersion();
510+
const detailLines = [
511+
`Version ${version}`,
512+
`Electron ${process.versions.electron}`,
513+
`Chromium ${process.versions.chrome}`,
514+
`Node ${process.versions.node}`,
515+
];
516+
const options = {
517+
type: "info" as const,
518+
title: "About Nexu",
519+
message: "Nexu",
520+
detail: detailLines.join("\n"),
521+
buttons: ["OK"],
522+
noLink: true,
523+
};
524+
void (mainWindow
525+
? dialog.showMessageBox(mainWindow, options)
526+
: dialog.showMessageBox(options));
527+
}
528+
508529
function installApplicationMenu(): void {
509530
const developMenu: MenuItemConstructorOptions = {
510531
label: "Develop",
@@ -542,20 +563,42 @@ function installApplicationMenu(): void {
542563
],
543564
};
544565

545-
const helpMenu: MenuItemConstructorOptions = {
546-
role: "help",
547-
submenu: [
566+
const helpSubmenu: MenuItemConstructorOptions[] = [
567+
{
568+
label: "Export Diagnostics…",
569+
click: () => {
570+
void exportDiagnostics({
571+
orchestrator,
572+
runtimeConfig,
573+
source: "help-menu",
574+
}).catch(() => undefined);
575+
},
576+
},
577+
];
578+
579+
// On macOS About/Check-for-Updates live in the application menu by
580+
// platform convention. On Windows/Linux there is no app menu, so surface
581+
// them in Help instead (issue nexu-io/nexu#784).
582+
if (process.platform !== "darwin") {
583+
helpSubmenu.push(
584+
{ type: "separator" },
548585
{
549-
label: "Export Diagnostics…",
550-
click: () => {
551-
void exportDiagnostics({
552-
orchestrator,
553-
runtimeConfig,
554-
source: "help-menu",
555-
}).catch(() => undefined);
556-
},
586+
id: "check-for-updates",
587+
label: "Check for Updates…",
588+
enabled: app.isPackaged && runtimeConfig.updates.autoUpdateEnabled,
589+
click: () => triggerUpdateCheck(),
557590
},
558-
],
591+
{
592+
id: "about-nexu",
593+
label: `About Nexu (v${app.getVersion()})`,
594+
click: () => showAboutDialog(),
595+
},
596+
);
597+
}
598+
599+
const helpMenu: MenuItemConstructorOptions = {
600+
role: "help",
601+
submenu: helpSubmenu,
559602
};
560603

561604
const template: MenuItemConstructorOptions[] = [

0 commit comments

Comments
 (0)