From 061279afaabbae309721c0dfc8853125dce1907f Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Wed, 18 Dec 2024 10:49:22 -0800 Subject: [PATCH] add version check --- Taskfile.yml | 2 +- docs/docs/config.mdx | 1 + docs/docs/faq.mdx | 6 ++++++ docs/docs/gettingstarted.mdx | 29 +++++++++++++++++++++++++++++ emain/emain.ts | 20 +++++++++++--------- emain/platform.ts | 24 +++++++++++++++++++++++- frontend/types/gotypes.d.ts | 1 + pkg/wconfig/metaconsts.go | 1 + pkg/wconfig/settingsconfig.go | 5 +++-- 9 files changed, 76 insertions(+), 13 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 98af8336a..beb8622e7 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -96,7 +96,7 @@ tasks: cmds: - cmd: '{{.RMRF}} "make"' ignore_error: true - - yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never + - yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never {{.CLI_ARGS}} deps: - yarn - docsite:build:embedded diff --git a/docs/docs/config.mdx b/docs/docs/config.mdx index 49cada776..ce8e48eb5 100644 --- a/docs/docs/config.mdx +++ b/docs/docs/config.mdx @@ -26,6 +26,7 @@ wsh editconfig | Key Name | Type | Function | | ------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | app:globalhotkey | string | A systemwide keybinding to open your most recent wave window. This is a set of key names separated by `:`. For more info, see [Customizable Systemwide Global Hotkey](#customizable-systemwide-global-hotkey) | +| app:dismissarchitecturewarning | bool | Disable warnings on app start when you are using a non-native architecture for Wave. For more info, see [Why does Wave warn me about ARM64 translation when it launches?](./faq#why-does-wave-warn-me-about-arm64-translation-when-it-launches). | | ai:preset | string | the default AI preset to use | | ai:baseurl | string | Set the AI Base Url (must be OpenAI compatible) | | ai:apitoken | string | your AI api token | diff --git a/docs/docs/faq.mdx b/docs/docs/faq.mdx index d8b84a151..b677af8d4 100644 --- a/docs/docs/faq.mdx +++ b/docs/docs/faq.mdx @@ -34,3 +34,9 @@ Just remember in JSON, backslashes need to be escaped. So add this to your [sett ### Can I use WSH outside of Wave? `wsh` is an internal CLI for extending control over Wave to the command line, you can learn more about it [here](./wsh). To prevent misuse by other applications, `wsh` requires an access token provided by Wave to work and will not function outside of the app. + +## Why does Wave warn me about ARM64 translation when it launches? + +macOS and Windows both have compatibility layers that allow x64 applications to run on ARM computers. This helps more apps run on these systems while developers work to add native ARM support to their applications, however it comes with significant performance tradeoffs. To get the best experience using Wave, it is recommended to install the version of Wave that is natively-compiled for your computer. You can find the right version by consulting our [Installation Instructions](./gettingstarted#installation) + +You can disable this warning by setting `app:dismissarchitecturewarning=true` in [your configurations](./config.mdx). diff --git a/docs/docs/gettingstarted.mdx b/docs/docs/gettingstarted.mdx index 9330ed77f..47e8c0273 100644 --- a/docs/docs/gettingstarted.mdx +++ b/docs/docs/gettingstarted.mdx @@ -14,6 +14,35 @@ Wave Terminal is a modern terminal that includes graphical capabilities like web +### Platform requirements + + + +- Supported architectures: Apple Silicon, x64 +- Supported OS version: macOS 11 Big Sur or later + + + + + +- Supported architectures: x64 +- Supported OS version: Windows 10 1809 or later, Windows 11 + +:::note + +ARM64 is planned, but is currently blocked by upstream dependencies (see [Windows ARM Support](https://github.com/wavetermdev/waveterm/issues/928)). + +::: + + + + + +- Supported architectures: x64, ARM64 +- Supported OS version: must have glibc-2.28 or later (Debian >=10, RHEL >=8, Ubuntu >=20.04, etc.) + + + ### Package managers diff --git a/emain/emain.ts b/emain/emain.ts index 76c2d731d..a23ece69d 100644 --- a/emain/emain.ts +++ b/emain/emain.ts @@ -47,6 +47,7 @@ import { getLaunchSettings } from "./launchsettings"; import { log } from "./log"; import { makeAppMenu } from "./menu"; import { + checkIfRunningUnderARM64Translation, getElectronAppBasePath, getElectronAppUnpackedBasePath, getWaveConfigDir, @@ -565,15 +566,6 @@ process.on("uncaughtException", (error) => { }); async function appMain() { - // Check if the user is requesting the version from the command line, if so, return it and bail out. - const args = process.argv; - if (args?.length > 1 && (args[1] === "--version" || args[1] === "-v")) { - const versionInfo = getWaveVersion(); - console.log(`Wave Terminal v${versionInfo.version} (build ${versionInfo.buildTime})`); - electronApp.quit(); - return; - } - // Set disableHardwareAcceleration as early as possible, if required. const launchSettings = getLaunchSettings(); if (launchSettings?.["window:disablehardwareacceleration"]) { @@ -597,6 +589,7 @@ async function appMain() { await electronApp.whenReady(); configureAuthKeyRequestInjection(electron.session.defaultSession); const fullConfig = await services.FileService.GetFullConfig(); + checkIfRunningUnderARM64Translation(fullConfig); ensureHotSpareTab(fullConfig); await relaunchBrowserWindows(); await initDocsite(); @@ -626,6 +619,15 @@ async function appMain() { } } +// Check if the user is requesting the version from the command line, if so, return it and bail out. +const args = process.argv; +console.log("args", args); +if (args?.length > 1 && (args.includes("--version") || args.includes("-v"))) { + const pkg = require("../package.json"); + console.log(`Wave Terminal v${pkg.version}`); + electronApp.quit(); +} + appMain().catch((e) => { console.log("appMain error", e); electronApp.quit(); diff --git a/emain/platform.ts b/emain/platform.ts index 2bab197f6..04a0b27ab 100644 --- a/emain/platform.ts +++ b/emain/platform.ts @@ -1,7 +1,8 @@ // Copyright 2024, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { app, ipcMain } from "electron"; +import { fireAndForget } from "@/util/util"; +import { app, dialog, ipcMain, shell } from "electron"; import envPaths from "env-paths"; import { existsSync, mkdirSync } from "fs"; import os from "os"; @@ -40,6 +41,27 @@ const WaveConfigHomeVarName = "WAVETERM_CONFIG_HOME"; const WaveDataHomeVarName = "WAVETERM_DATA_HOME"; const WaveHomeVarName = "WAVETERM_HOME"; +export function checkIfRunningUnderARM64Translation(fullConfig: FullConfigType) { + if (!fullConfig.settings["app:dismissarchitecturewarning"] && app.runningUnderARM64Translation) { + console.log("Running under ARM64 translation, alerting user"); + const dialogOpts: Electron.MessageBoxOptions = { + type: "warning", + buttons: ["See documentation", "Dismiss"], + title: "Wave has detected a performance issue", + message: `Wave has detected that it is running in ARM64 translation mode.\n\nThis may cause performance issues.\n\nPlease download the native version of Wave for your architecture (${unameArch})`, + }; + + const choice = dialog.showMessageBoxSync(null, dialogOpts); + if (choice === 0) { + // Open the documentation URL + console.log("Opening documentation URL"); + fireAndForget(() => shell.openExternal("https://docs.waveterm.dev")); + } else { + console.log("User dismissed the dialog"); + } + } +} + /** * Gets the path to the old Wave home directory (defaults to `~/.waveterm`). * @returns The path to the directory if it exists and contains valid data for the current app, otherwise null. diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index c0149d01e..831c9e734 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -618,6 +618,7 @@ declare global { type SettingsType = { "app:*"?: boolean; "app:globalhotkey"?: string; + "app:dismissarchitecturewarning"?: boolean; "ai:*"?: boolean; "ai:preset"?: string; "ai:apitype"?: string; diff --git a/pkg/wconfig/metaconsts.go b/pkg/wconfig/metaconsts.go index 7e95579ad..a1ddaeb4a 100644 --- a/pkg/wconfig/metaconsts.go +++ b/pkg/wconfig/metaconsts.go @@ -8,6 +8,7 @@ package wconfig const ( ConfigKey_AppClear = "app:*" ConfigKey_AppGlobalHotkey = "app:globalhotkey" + ConfigKey_AppDismissArchitectureWarning = "app:dismissarchitecturewarning" ConfigKey_AiClear = "ai:*" ConfigKey_AiPreset = "ai:preset" diff --git a/pkg/wconfig/settingsconfig.go b/pkg/wconfig/settingsconfig.go index 8b312db4b..b1461eb6f 100644 --- a/pkg/wconfig/settingsconfig.go +++ b/pkg/wconfig/settingsconfig.go @@ -33,8 +33,9 @@ const AnySchema = ` ` type SettingsType struct { - AppClear bool `json:"app:*,omitempty"` - AppGlobalHotkey string `json:"app:globalhotkey,omitempty"` + AppClear bool `json:"app:*,omitempty"` + AppGlobalHotkey string `json:"app:globalhotkey,omitempty"` + AppDismissArchitectureWarning bool `json:"app:dismissarchitecturewarning,omitempty"` AiClear bool `json:"ai:*,omitempty"` AiPreset string `json:"ai:preset,omitempty"`