feat(client): show warning when running through rosetta 2

This commit is contained in:
perf3ct
2025-06-11 14:04:42 +00:00
parent 3f5024dc6d
commit 23ce896681
7 changed files with 150 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ import electronContextMenu from "./menus/electron_context_menu.js";
import glob from "./services/glob.js";
import { t } from "./services/i18n.js";
import options from "./services/options.js";
import server from "./services/server.js";
import type ElectronRemote from "@electron/remote";
import type Electron from "electron";
import "./stylesheets/bootstrap.scss";
@@ -22,7 +23,10 @@ bundleService.getWidgetBundlesByParent().then(async (widgetBundles) => {
const DesktopLayout = (await import("./layouts/desktop_layout.js")).default;
appContext.setLayout(new DesktopLayout(widgetBundles));
appContext.start().catch((e) => {
appContext.start().then(() => {
// Check for Rosetta 2 after the app has fully started
checkRosetta2Warning();
}).catch((e) => {
toastService.showPersistent({
title: t("toast.critical-error.title"),
icon: "alert",
@@ -114,3 +118,18 @@ function initDarkOrLightMode(style: CSSStyleDeclaration) {
const { nativeTheme } = utils.dynamicRequire("@electron/remote") as typeof ElectronRemote;
nativeTheme.themeSource = themeSource;
}
async function checkRosetta2Warning() {
if (!utils.isElectron()) return;
try {
// Check if running under Rosetta 2 by calling the server
const response = await server.get("api/system-info/rosetta-check") as { isRunningUnderRosetta2: boolean };
if (response.isRunningUnderRosetta2) {
// Trigger the Rosetta 2 warning dialog
appContext.triggerCommand("showRosettaWarning", {});
}
} catch (error) {
console.warn("Could not check Rosetta 2 status:", error);
}
}