From 56677da8ad91d4b71a602afe55fe1494e312c737 Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Sun, 3 May 2026 11:49:42 +0200 Subject: [PATCH] refactor(desktop): pass trayActions to buildAppMenuTemplate, remove appMenuActions duplication buildAppMenuTemplate's actions param is Partial, so the tray-only callbacks (onShow/onHide/onQuit) are simply ignored. Removes the three-callback duplication between the two objects without changing behavior. Future onChangeInstance/onCheckForUpdates/onRestartToInstall changes only need to be made in one place. --- packages/desktop/src/main.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/desktop/src/main.ts b/packages/desktop/src/main.ts index 0bc14799..52a8caba 100644 --- a/packages/desktop/src/main.ts +++ b/packages/desktop/src/main.ts @@ -878,23 +878,12 @@ if (!gotTheLock) { onQuit: () => requestQuit(), }; - const appMenuActions = { - onChangeInstance: () => { - clearInstanceUrl(); - mainWindow?.loadFile(getPickerPath()); - mainWindow?.show(); - mainWindow?.focus(); - }, - onCheckForUpdates: () => handleRecoveryAction('check-update'), - onRestartToInstall: () => handleRecoveryAction('install-update'), - }; - const applyMenusForState = (state: RecoveryState): void => { if (tray) { tray.setContextMenu(Menu.buildFromTemplate(buildTrayMenuTemplate(state, trayActions))); } if (process.platform === 'darwin') { - Menu.setApplicationMenu(Menu.buildFromTemplate(buildAppMenuTemplate(app.name, state, appMenuActions))); + Menu.setApplicationMenu(Menu.buildFromTemplate(buildAppMenuTemplate(app.name, state, trayActions))); } // Mode-gated push to renderer (recovery.html subscribes to this). if (state.mode === 'recovery' && mainWindow && !mainWindow.isDestroyed()) {