feat(desktop): prefer the bundled renderer, own update prompts (#3341)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-09 03:01:15 +02:00
1 parent 7a5b9a0ded
commit 5072488f1e
33 files changed
+2197 -113

No files matched your search

+16 -1
View File
@@ -11,6 +11,8 @@ import type {
TrayActionPayload,
TrayRuntimeStatePayload,
} from '@electron/common/Types';
import {getDesktopUpdateState, observeDesktopUpdateState} from '@electron/main/DesktopUpdateGate';
import {checkForUpdatesFromShell, startDesktopUpdateFromShell} from '@electron/main/DesktopUpdatePrompt';
import {relaunchStableLaunchPath} from '@electron/main/LinuxLaunchPath';
import {onLocaleChange, t} from '@electron/main/MainI18n';
import {app, type BrowserWindow, clipboard, Menu, nativeImage, Tray} from 'electron';
@@ -72,6 +74,9 @@ export function updateTrayRuntimeState(update: Partial<TrayRuntimeStatePayload>,
if (webContentsId !== undefined) {
trayActionBridgeWebContentsId = webContentsId;
}
if (typeof update.buildInfo === 'string' && update.buildInfo !== trayState.buildInfo) {
logger.info(`The renderer reported its build: ${update.buildInfo}`);
}
Object.assign(trayState, update);
refreshDesktopTrayMenu();
schedulePendingTrayActionFlush();
@@ -388,9 +393,18 @@ function buildTrayMenu(): Menu {
});
}
menuTemplate.push({type: 'separator'});
if (getDesktopUpdateState().available) {
menuTemplate.push({
label: t('desktop.tray.updateNow', {appName: APP_NAME}),
click: () => runTrayMenuAction(startDesktopUpdateFromShell),
});
}
menuTemplate.push({
label: t('desktop.tray.checkForUpdates'),
click: () => runTrayMenuAction(() => dispatchTrayAction({action: 'check-for-updates'})),
click: () =>
runTrayMenuAction(() => {
void checkForUpdatesFromShell();
}),
});
if (trayState.buildInfo) {
menuTemplate.push({
@@ -533,6 +547,7 @@ export function initializeDesktopTray(nextController: DesktopTrayController): vo
}
refreshDesktopTrayMenu();
});
observeDesktopUpdateState(refreshDesktopTrayMenu);
}
}