A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
gui: replace the update banner with a dot, and let Settings install it
RoversX648eb3dc8e52
diff --git a/wezterm-gui/Cargo.toml b/wezterm-gui/Cargo.tomlindex bf9a267b..dd6a4700 100644--- a/wezterm-gui/Cargo.toml+++ b/wezterm-gui/Cargo.toml@@ -67,7 +67,6 @@ fluent-langneg.workspace = truefrecency.workspace = truefutures.workspace = truehdrhistogram.workspace = true-http_req.workspace = trueignore.workspace = trueimage.workspace = truelazy_static.workspace = true@@ -106,6 +105,7 @@ termwiz-funcs.workspace = truetermwiz.workspace = truetextwrap.workspace = truethinkterm-proto.workspace = true+thinkterm-update.workspace = truethiserror.workspace = truetiny-skia.workspace = truethinkterm-syntax = { path = "../thinkterm-syntax" }@@ -138,7 +138,6 @@ window-funcs.workspace = truewindow.workspace = true[target.'cfg(target_os = "macos")'.dependencies]-plist.workspace = true[target.'cfg(windows)'.dependencies]shared_library.workspace = truediff --git a/wezterm-gui/i18n/en-US.ftl b/wezterm-gui/i18n/en-US.ftlindex bc2d6b82..57da2321 100644--- a/wezterm-gui/i18n/en-US.ftl+++ b/wezterm-gui/i18n/en-US.ftl@@ -648,3 +648,21 @@ settings-sidebar-description = Choose which panels the right sidebar offers. Tursettings-sidebar-files-description = Browse the working directory, and remote directories over SFTP.settings-sidebar-notes-description = Markdown notes kept alongside the project.settings-sidebar-snippets-description = Saved commands and text you can paste into a pane.++# Update notice (toast) and the Software Update page's install flow.+update-toast-title = ThinkTerm update available+update-toast-body = Click to see what's new+settings-update-install = Install Update+settings-update-installing = Installing… this window keeps working while the files are replaced.+settings-update-installed = Installed ThinkTerm { $version }. Quit and reopen ThinkTerm to use it.+settings-update-install-failed = The update could not be installed: { $error }+settings-update-install-note = Install Update replaces the files in place; ThinkTerm keeps running the current version until you reopen it.+settings-update-method-script = Installed by the install script ({ $variant } variant).+settings-update-method-macapp = ThinkTerm.app installed by hand at { $path }; installing an update replaces it there and adds the command-line tools under ~/.local/bin.+settings-update-method-appimage = This is an AppImage: update it with AppImageUpdate, or download the new AppImage from the releases page.+settings-update-method-homebrew = Installed with Homebrew: run `brew upgrade thinkterm`.+settings-update-method-nix = Installed from the Nix store: update it through your Nix configuration.+settings-update-method-system = Installed by the system package manager: install the new package from the releases page with apt, dnf or whatever installed this one.+settings-update-method-windows = Installed by the Windows installer; installing an update downloads the new installer and runs it.+settings-update-method-source = This is a build from source: pull the repository and build again.+settings-update-method-unknown = This copy was not installed by the install script, so ThinkTerm will not replace it; update it the way it was installed.diff --git a/wezterm-gui/i18n/fr-FR.ftl b/wezterm-gui/i18n/fr-FR.ftlindex 19f2c3b4..7c25f16f 100644--- a/wezterm-gui/i18n/fr-FR.ftl+++ b/wezterm-gui/i18n/fr-FR.ftl@@ -645,3 +645,21 @@ settings-sidebar-description = Choisissez les panneaux proposés par la barre lasettings-sidebar-files-description = Parcourir le répertoire de travail, et les répertoires distants via SFTP.settings-sidebar-notes-description = Notes Markdown conservées avec le projet.settings-sidebar-snippets-description = Commandes et textes enregistrés, à coller dans un panneau.++# Notification de mise à jour et installation depuis la page Mise à jour logicielle.+update-toast-title = Mise à jour de ThinkTerm disponible+update-toast-body = Cliquez pour voir les nouveautés+settings-update-install = Installer la mise à jour+settings-update-installing = Installation… cette fenêtre reste utilisable pendant le remplacement des fichiers.+settings-update-installed = ThinkTerm { $version } est installé. Quittez et rouvrez ThinkTerm pour l'utiliser.+settings-update-install-failed = La mise à jour n'a pas pu être installée : { $error }+settings-update-install-note = Installer la mise à jour remplace les fichiers sur place ; ThinkTerm continue d'exécuter la version actuelle jusqu'à sa réouverture.+settings-update-method-script = Installé par le script d'installation (variante { $variant }).+settings-update-method-macapp = ThinkTerm.app installé manuellement dans { $path } ; la mise à jour le remplace à cet endroit et ajoute les outils en ligne de commande dans ~/.local/bin.+settings-update-method-appimage = Ceci est une AppImage : mettez-la à jour avec AppImageUpdate ou téléchargez la nouvelle AppImage depuis la page des versions.+settings-update-method-homebrew = Installé avec Homebrew : exécutez `brew upgrade thinkterm`.+settings-update-method-nix = Installé depuis le store Nix : mettez-le à jour via votre configuration Nix.+settings-update-method-system = Installé par le gestionnaire de paquets du système : installez le nouveau paquet de la page des versions avec apt, dnf ou l'outil d'origine.+settings-update-method-windows = Installé par l'installateur Windows ; la mise à jour télécharge le nouvel installateur et l'exécute.+settings-update-method-source = Ceci est une compilation depuis les sources : mettez à jour le dépôt et recompilez.+settings-update-method-unknown = Cette copie n'a pas été installée par le script d'installation ; ThinkTerm ne la remplacera pas. Mettez-la à jour comme elle a été installée.diff --git a/wezterm-gui/i18n/ja-JP.ftl b/wezterm-gui/i18n/ja-JP.ftlindex cd4c9bf7..9b3ba7ea 100644--- a/wezterm-gui/i18n/ja-JP.ftl+++ b/wezterm-gui/i18n/ja-JP.ftl@@ -633,3 +633,21 @@ settings-sidebar-description = 右サイドバーに表示するパネルを選settings-sidebar-files-description = 作業ディレクトリと、SFTP 経由のリモートディレクトリを閲覧します。settings-sidebar-notes-description = プロジェクトと一緒に置く Markdown のノートです。settings-sidebar-snippets-description = 保存したコマンドやテキストを、ペインに貼り付けられます。++# 更新通知(トースト)と「ソフトウェアアップデート」ページのインストール処理。+update-toast-title = ThinkTerm の新しいバージョンがあります+update-toast-body = クリックして更新内容を表示+settings-update-install = アップデートをインストール+settings-update-installing = インストール中… ファイルの置き換え中もこのウィンドウは使えます。+settings-update-installed = ThinkTerm { $version } をインストールしました。ThinkTerm を終了して開き直すと新しいバージョンになります。+settings-update-install-failed = アップデートをインストールできませんでした: { $error }+settings-update-install-note = 「アップデートをインストール」はファイルをその場で置き換えます。開き直すまで ThinkTerm は現在のバージョンのまま動作します。+settings-update-method-script = インストールスクリプトでインストールされています({ $variant } 版)。+settings-update-method-macapp = { $path } に手動でインストールされた ThinkTerm.app です。アップデートはその場所で置き換え、コマンドラインツールを ~/.local/bin に追加します。+settings-update-method-appimage = これは AppImage です。AppImageUpdate で更新するか、リリースページから新しい AppImage をダウンロードしてください。+settings-update-method-homebrew = Homebrew でインストールされています。`brew upgrade thinkterm` を実行してください。+settings-update-method-nix = Nix store からインストールされています。Nix の設定から更新してください。+settings-update-method-system = システムのパッケージマネージャーでインストールされています。リリースページの新しいパッケージを apt や dnf など元の方法でインストールしてください。+settings-update-method-windows = Windows インストーラーでインストールされています。アップデートは新しいインストーラーをダウンロードして実行します。+settings-update-method-source = ソースからのビルドです。リポジトリを更新して再ビルドしてください。+settings-update-method-unknown = このコピーはインストールスクリプトによるものではないため、ThinkTerm は置き換えません。元の方法で更新してください。diff --git a/wezterm-gui/i18n/zh-CN.ftl b/wezterm-gui/i18n/zh-CN.ftlindex 83fa877f..bacc9413 100644--- a/wezterm-gui/i18n/zh-CN.ftl+++ b/wezterm-gui/i18n/zh-CN.ftl@@ -633,3 +633,21 @@ settings-sidebar-description = 选择右侧栏提供哪些面板。全部关掉settings-sidebar-files-description = 浏览工作目录,以及通过 SFTP 浏览远程目录。settings-sidebar-notes-description = 与项目放在一起的 Markdown 笔记。settings-sidebar-snippets-description = 保存的命令和文本,可以粘贴到面板中。++# 更新提醒(系统通知)与"软件更新"页的安装流程。+update-toast-title = ThinkTerm 有新版本+update-toast-body = 点击查看更新内容+settings-update-install = 安装更新+settings-update-installing = 正在安装……替换文件期间本窗口可以继续使用。+settings-update-installed = 已安装 ThinkTerm { $version }。退出并重新打开 ThinkTerm 即可使用新版本。+settings-update-install-failed = 更新安装失败:{ $error }+settings-update-install-note = "安装更新"会原地替换文件;在你重新打开之前,ThinkTerm 仍运行当前版本。+settings-update-method-script = 由安装脚本安装({ $variant } 版本)。+settings-update-method-macapp = 手动安装在 { $path } 的 ThinkTerm.app;安装更新会在原位置替换它,并把命令行工具放到 ~/.local/bin。+settings-update-method-appimage = 这是 AppImage:用 AppImageUpdate 更新,或从发布页下载新的 AppImage。+settings-update-method-homebrew = 通过 Homebrew 安装:运行 `brew upgrade thinkterm`。+settings-update-method-nix = 来自 Nix store:通过你的 Nix 配置更新。+settings-update-method-system = 由系统包管理器安装:从发布页下载新包,用 apt、dnf 或原来的方式安装。+settings-update-method-windows = 由 Windows 安装器安装;安装更新会下载新安装器并运行。+settings-update-method-source = 这是从源码构建的版本:拉取仓库后重新构建。+settings-update-method-unknown = 这个副本不是由安装脚本安装的,ThinkTerm 不会替换它;请按原来的安装方式更新。diff --git a/wezterm-gui/src/main.rs b/wezterm-gui/src/main.rsindex 19d1d2a0..9cbb86e8 100644--- a/wezterm-gui/src/main.rs+++ b/wezterm-gui/src/main.rs@@ -1165,7 +1165,7 @@ fn setup_mux(.unwrap_or(mux::DEFAULT_WORKSPACE),);mux.set_active_workspace(&default_workspace_name);- crate::update::load_last_release_info_and_set_banner();+ crate::update::load_last_release_info();update_mux_domains(config)?;// Register ThinkTerm's saved SSH hosts as runtime mux domains so that// reconnecting / restoring remote sessions can resolve them by name.@@ -1291,6 +1291,21 @@ fn run_terminal_gui(opts: StartCommand, default_domain_name: Option<String>) ->.detach();maybe_show_configuration_error_window();+ // A debugging hook alongside THINKTERM_FRAME_DUMP: open the Settings+ // window on a given section once the GUI is up, so a page can be+ // captured from a scripted launch with no keyboard or mouse.+ if let Some(page) = std::env::var_os("THINKTERM_OPEN_SETTINGS") {+ promise::spawn::spawn_into_main_thread(async move {+ smol::Timer::after(std::time::Duration::from_millis(2500)).await;+ if page == "update" {+ crate::settings_window::show_update_page();+ } else {+ crate::settings_window::show();+ }+ })+ .detach();+ }+gui.run_forever()}diff --git a/wezterm-gui/src/settings_window.rs b/wezterm-gui/src/settings_window.rsindex bb8a5bef..eb0a4cf9 100644--- a/wezterm-gui/src/settings_window.rs+++ b/wezterm-gui/src/settings_window.rs@@ -194,7 +194,14 @@ fn format_archived_when(archived_at: i64) -> String {/// tinted status glyph on Software Update.enum HeroBadge {AppIcon,- Status { icon: SvgIcon, tint: LinearRgba },+}++/// An install run from the Update page, from the click to its outcome.+#[derive(Debug, Clone)]+enum UpdateInstall {+ Running,+ Installed { version: String },+ Failed { error: String },}/// What the Update page's status card can say. Derived from the on-disk@@ -226,13 +233,6 @@ fn status_tint_positive(appearance: Appearance) -> LinearRgba {}}-fn status_tint_neutral(appearance: Appearance) -> LinearRgba {- match appearance {- Appearance::Light | Appearance::LightHighContrast => rgba(142, 142, 147, 1.0),- Appearance::Dark | Appearance::DarkHighContrast => rgba(120, 120, 128, 1.0),- }-}-/// Secondary text sits a step below the label. Clamped at 350 so a user who/// already runs a light UI weight does not end up with hairline text.fn settings_body_font_weight(label_weight: u16) -> u16 {@@ -737,6 +737,7 @@ enum SettingsAction {ResetInputDiagnostics,CopyInputDiagnostics,CheckForUpdates,+ InstallUpdate,OpenLatestRelease,OpenReleasesIndex,OpenSourceRepository,@@ -1246,6 +1247,13 @@ struct SettingsUiState {/// Set briefly after Check Now so the button can report that it ran even/// when the cached answer is unchanged.update_checked_until: Option<Instant>,+ /// How this copy was installed, which decides whether the page can+ /// install an update itself or only say who can. Read with the status:+ /// it looks at the filesystem, so never on the paint path.+ update_method: Option<thinkterm_update::InstallMethod>,+ /// The install started from this page, if any. Runs on its own thread+ /// and reports back through the instance id.+ update_install: Option<UpdateInstall>,version_info_copied_until: Option<Instant>,sidebar_scrollbar_visible_until: Option<Instant>,content_scrollbar_visible_until: Option<Instant>,@@ -1283,6 +1291,8 @@ impl SettingsUiState {input_diagnostics_copied_until: None,update_status: None,update_checked_until: None,+ update_method: None,+ update_install: None,version_info_copied_until: None,sidebar_scrollbar_visible_until: None,content_scrollbar_visible_until: None,@@ -1665,7 +1675,6 @@ struct SettingsPalette {control_pressed_bg: LinearRgba,control_border: LinearRgba,card_bg: LinearRgba,- accent: LinearRgba,on_accent: LinearRgba,title: LinearRgba,text: LinearRgba,@@ -1925,6 +1934,7 @@ impl SettingsWindow {// Same reasoning for the update cache: the window can open straight// onto Update or About, and both read it while painting.ui.update_status = Some(crate::update::cached_update_status());+ ui.update_method = Some(thinkterm_update::InstallMethod::detect());let settings = Rc::new(RefCell::new(Self {instance_id,@@ -3252,7 +3262,6 @@ impl SettingsWindow {control_pressed_bg: ui.control_pressed_bg,control_border: ui.control_border,card_bg: ui.card_bg,- accent: ui.accent,on_accent: ui.on_accent,title: ui.text,text: ui.text,@@ -3378,6 +3387,7 @@ impl SettingsWindow {// the page picks up a check that ran while the window sat on// another section.self.ui.update_status = Some(crate::update::cached_update_status());+ self.ui.update_method = Some(thinkterm_update::InstallMethod::detect());}}@@ -3985,9 +3995,73 @@ impl SettingsWindow {// one small read rather than a blocking HTTP request on the UI// thread. The live check replaces this call, not the button.self.ui.update_status = Some(crate::update::cached_update_status());+ self.ui.update_method = Some(thinkterm_update::InstallMethod::detect());self.ui.update_checked_until = Some(Instant::now() + Duration::from_millis(1400));self.schedule_copied_state_clear(window);}+ SettingsAction::InstallUpdate => {+ self.ui.open_dropdown = None;+ if matches!(self.ui.update_install, Some(UpdateInstall::Running)) {+ return;+ }+ let Some(release) = self+ .ui+ .update_status+ .as_ref()+ .and_then(|status| status.latest.clone())+ else {+ return;+ };+ let method = self+ .ui+ .update_method+ .clone()+ .unwrap_or_else(thinkterm_update::InstallMethod::detect);+ self.ui.update_install = Some(UpdateInstall::Running);+ window.invalidate();++ // The installer downloads and replaces files: off the UI+ // thread, with the outcome posted back to whichever settings+ // window instance asked, if it is still open.+ let instance_id = self.instance_id;+ let window = window.clone();+ std::thread::Builder::new()+ .name("thinkterm-update-install".into())+ .spawn(move || {+ let version = release.tag_name.trim_start_matches('v').to_string();+ let result = if cfg!(windows) {+ thinkterm_update::run_windows_installer(&release).map(|_| ())+ } else {+ match method.manifest_for_install() {+ Some(manifest) => thinkterm_update::run_local_installer_captured(+ &manifest,+ &release.tag_name,+ )+ .map(|_| ()),+ None => Err(anyhow::anyhow!("{}", method.how_to_update())),+ }+ };+ let outcome = match result {+ Ok(()) => UpdateInstall::Installed { version },+ Err(err) => UpdateInstall::Failed {+ error: format!("{err:#}"),+ },+ };+ promise::spawn::spawn_into_main_thread(async move {+ if let Some(settings) = settings_window_for_instance(instance_id) {+ let mut settings = settings.borrow_mut();+ settings.ui.update_install = Some(outcome);+ settings.ui.update_status =+ Some(crate::update::cached_update_status());+ settings.ui.update_method =+ Some(thinkterm_update::InstallMethod::detect());+ window.invalidate();+ }+ })+ .detach();+ })+ .ok();+ }SettingsAction::OpenLatestRelease => {self.ui.open_dropdown = None;let url = self@@ -7227,35 +7301,6 @@ impl SettingsWindow {Ok(())}- /// A filled, rounded tile with a white glyph centered in it -- the badge- /// that carries the Update page's status and the About page's app mark.- fn paint_status_badge(- &self,- layers: &mut TripleLayerQuadAllocator<'_>,- icon: SvgIcon,- x: f32,- y: f32,- size: f32,- tint: LinearRgba,- ) -> anyhow::Result<()> {- // A disc rather than a rounded square: the badge states a status, and- // the app's own mark on About is the rounded square. The shadow is the- // same one a selected sidebar row gets, so the two lift by the same- // amount.- let radius = size / 2.0;- self.paint_active_row_shadow(layers, x, y, size, size, radius)?;- self.draw_rounded_frame(layers, 0, x, y, size, size, tint, tint, radius)?;- let glyph = (size * 0.5).round();- self.draw_svg_icon(- layers,- icon,- x + (size - glyph) / 2.0,- y + (size - glyph) / 2.0,- glyph,- LinearRgba::with_components(1.0, 1.0, 1.0, 1.0),- )- }-/// Row geometry for the two app-level pages. Unlike `settings_row_step`/// these rows carry no explanation line, so they are a single line tall/// -- the shape macOS System Settings uses for a list of plain facts.@@ -7402,6 +7447,35 @@ impl SettingsWindow {}}+ /// One localized sentence on how this copy gets updated, from the+ /// detected install method.+ fn update_method_note(&self) -> String {+ use thinkterm_update::InstallMethod;+ match self.ui.update_method.as_ref() {+ Some(InstallMethod::Script(m)) => settings_tr(+ "settings-update-method-script",+ &[("variant", m.variant.clone())],+ ),+ Some(InstallMethod::MacAppBundle(app)) => settings_tr(+ "settings-update-method-macapp",+ &[("path", app.display().to_string())],+ ),+ Some(InstallMethod::AppImage) => crate::i18n::tr("settings-update-method-appimage"),+ Some(InstallMethod::Homebrew) => crate::i18n::tr("settings-update-method-homebrew"),+ Some(InstallMethod::Nix) => crate::i18n::tr("settings-update-method-nix"),+ Some(InstallMethod::SystemPackage) => {+ crate::i18n::tr("settings-update-method-system")+ }+ Some(InstallMethod::WindowsInstaller) => {+ crate::i18n::tr("settings-update-method-windows")+ }+ Some(InstallMethod::SourceBuild) => crate::i18n::tr("settings-update-method-source"),+ Some(InstallMethod::Unknown) | None => {+ crate::i18n::tr("settings-update-method-unknown")+ }+ }+ }+fn running_version_label(&self) -> String {self.ui.update_status@@ -7452,9 +7526,6 @@ impl SettingsWindow {let mark_y = y + (height - mark) / 2.0;match badge {HeroBadge::AppIcon => self.draw_app_icon(layers, mark_x, mark_y, mark)?,- HeroBadge::Status { icon, tint } => {- self.paint_status_badge(layers, icon, mark_x, mark_y, mark, tint)?- }}let text_x = mark_x + mark + self.ui_px(24.0);@@ -7603,16 +7674,14 @@ impl SettingsWindow {let hero = self.update_hero();let version = self.running_version_label();- let (icon, tint, headline, subline) = match &hero {+ // The app icon, as on About: the page is about ThinkTerm, and the+ // state is already in the headline.+ let (headline, subline) = match &hero {UpdateHero::UpToDate => (- SvgIcon::Check,- status_tint_positive(appearance),crate::i18n::tr("settings-update-current"),settings_tr("settings-update-current-detail", &[("version", version)]),),UpdateHero::Available { tag } => (- SvgIcon::Download,- palette.accent,crate::i18n::tr("settings-update-available"),settings_tr("settings-update-available-detail",@@ -7620,8 +7689,6 @@ impl SettingsWindow {),),UpdateHero::LocalBuild => (- SvgIcon::Package,- status_tint_neutral(appearance),crate::i18n::tr("settings-update-local-build"),settings_tr("settings-update-local-build-detail",@@ -7629,8 +7696,6 @@ impl SettingsWindow {),),UpdateHero::Unknown => (- SvgIcon::RefreshCw,- status_tint_neutral(appearance),crate::i18n::tr("settings-update-unknown"),settings_tr("settings-update-unknown-detail", &[("version", version)]),),@@ -7646,16 +7711,36 @@ impl SettingsWindow {crate::i18n::tr("settings-update-check-now")};+ // The one button on the hero: install when there is something to+ // install and this copy is ours to replace, check otherwise. While+ // an install runs there is nothing to click.+ let self_updatable = self+ .ui+ .update_method+ .as_ref()+ .is_some_and(|method| method.self_updatable() || cfg!(windows));+ let hero_button = match (&hero, &self.ui.update_install) {+ (_, Some(UpdateInstall::Running)) => None,+ (UpdateHero::Available { .. }, Some(UpdateInstall::Installed { .. })) => {+ Some((check_label, SettingsAction::CheckForUpdates))+ }+ (UpdateHero::Available { .. }, _) if self_updatable => Some((+ crate::i18n::tr("settings-update-install"),+ SettingsAction::InstallUpdate,+ )),+ _ => Some((check_label, SettingsAction::CheckForUpdates)),+ };+let hero_y = self.ui_px(CONTENT_SECTION_Y) - scroll;let hero_height = self.paint_hero(layers,x,hero_y,max_width,- HeroBadge::Status { icon, tint },+ HeroBadge::AppIcon,&headline,&subline,- Some((check_label, SettingsAction::CheckForUpdates)),+ hero_button,)?;// Three plain facts, one line each: the labels say what they are, and@@ -7701,16 +7786,52 @@ impl SettingsWindow {)?;}+ // Under the facts: what an install would do here, or why this page+ // cannot do one, and the outcome of the install just run.let note_y = card_y + card_height + gap;- self.draw_text(- layers,- &body_font,- x,- note_y,- &crate::i18n::tr("settings-update-manual-note"),+ let line_step = self.metrics.cell_size.height as f32 + self.ui_px(6.0);+ let mut notes: Vec<(String, LinearRgba)> = Vec::new();+ match &self.ui.update_install {+ Some(UpdateInstall::Running) => {+ notes.push((crate::i18n::tr("settings-update-installing"), palette.text));+ }+ Some(UpdateInstall::Installed { version }) => notes.push((+ settings_tr("settings-update-installed", &[("version", version.clone())]),+ status_tint_positive(appearance),+ )),+ Some(UpdateInstall::Failed { error }) => notes.push((+ settings_tr("settings-update-install-failed", &[("error", error.clone())]),+ crate::ui::tokens::UiPalette::for_appearance(appearance).danger,+ )),+ None => {}+ }+ notes.push((+ self.update_method_note(),palette.secondary_text,- max_width,- )?;+ ));+ if self_updatable && !matches!(self.ui.update_install, Some(UpdateInstall::Installed { .. })) {+ notes.push((+ crate::i18n::tr("settings-update-install-note"),+ palette.secondary_text,+ ));+ }+ let mut lines_drawn = 0usize;+ for (text, color) in ¬es {+ let wrapped = self.wrap_settings_text(&body_font, text, max_width);+ for line in wrapped {+ self.draw_text(+ layers,+ &body_font,+ x,+ note_y + line_step * lines_drawn as f32,+ &line,+ *color,+ max_width,+ )?;+ lines_drawn += 1;+ }+ }+ let note_y = note_y + line_step * lines_drawn.saturating_sub(1) as f32;let (link_label, link_action) = match &hero {UpdateHero::Available { .. } => (diff --git a/wezterm-gui/src/termwindow/ui/sidebar.rs b/wezterm-gui/src/termwindow/ui/sidebar.rsindex dfc11985..133578e8 100644--- a/wezterm-gui/src/termwindow/ui/sidebar.rs+++ b/wezterm-gui/src/termwindow/ui/sidebar.rs@@ -3212,6 +3212,37 @@ impl crate::TermWindow {settings_icon_size,foreground,)?;+ // A newer release exists: a dot on the gear's shoulder, ringed in+ // the sidebar background so it reads on the icon rather than in+ // it. This is the whole in-app notice; the page it leads to has+ // the details and the button.+ if crate::update::update_available() {+ let dot = (settings_icon_size / 3).max(self.ui_px(5)) as f32;+ let ring = dot + 2.0 * self.ui_f32(1.5);+ let dot_x = (settings_icon_x + settings_icon_size) as f32 - dot * 0.75;+ let dot_y = settings_icon_y as f32 - dot * 0.25;+ self.fill_rounded_rectangle(+ layers,+ 2,+ euclid::rect(+ dot_x - (ring - dot) / 2.0,+ dot_y - (ring - dot) / 2.0,+ ring,+ ring,+ ),+ chrome.workspace_sidebar_bg,+ ring / 2.0,+ )+ .context("sidebar update dot ring")?;+ self.fill_rounded_rectangle(+ layers,+ 2,+ euclid::rect(dot_x, dot_y, dot, dot),+ chrome.accent,+ dot / 2.0,+ )+ .context("sidebar update dot")?;+ }// A truncated "S…" reads worse than no label: when the sidebar is// too narrow for the whole word, the gear icon stands alone (and// the row shrank to an icon pill above).diff --git a/wezterm-gui/src/update.rs b/wezterm-gui/src/update.rsindex 376c99b7..98142a69 100644--- a/wezterm-gui/src/update.rs+++ b/wezterm-gui/src/update.rs@@ -1,225 +1,62 @@-use crate::ICON_DATA;-use anyhow::anyhow;-use config::{configuration, wezterm_version};-use http_req::request::{HttpVersion, Request};-use http_req::uri::Uri;+use config::configuration;use mux::connui::ConnectionUI;-use serde::*;-use std::convert::TryFrom;use std::sync::atomic::{AtomicBool, Ordering};use std::sync::Mutex;use std::time::{Duration, SystemTime};-use termwiz::cell::{Hyperlink, Underline};-use termwiz::color::AnsiColor;-use termwiz::escape::csi::{Cursor, Sgr};-use termwiz::escape::osc::{ITermDimension, ITermFileData, ITermProprietary};-use termwiz::escape::{OneBased, OperatingSystemCommand, CSI};use wezterm_toast_notification::*;-#[derive(Debug, Serialize, Deserialize, Clone)]-pub struct Release {- pub url: String,- pub body: String,- pub html_url: String,- pub tag_name: String,- pub assets: Vec<Asset>,-}--#[derive(Debug, Serialize, Deserialize, Clone)]-pub struct Asset {- pub name: String,- pub size: usize,- pub url: String,- pub browser_download_url: String,-}--/// The repository every update link points at. The update check, the toast,-/// and the Settings Update/About pages all build their URLs from this, so a-/// fork or a rename is one edit rather than a grep.-pub const REPO_URL: &str = "https://github.com/RoversX/thinkterm";--pub fn releases_url() -> String {- format!("{REPO_URL}/releases")-}--pub fn release_tag_url(tag: &str) -> String {- format!("{REPO_URL}/releases/tag/{tag}")-}--fn get_github_release_info(uri: &str) -> anyhow::Result<Release> {- let uri = Uri::try_from(uri)?;-- let mut latest = Vec::new();- let _res = Request::new(&uri)- .version(HttpVersion::Http10)- .header("User-Agent", &format!("thinkterm/{}", wezterm_version()))- .send(&mut latest)- .map_err(|e| anyhow!("failed to query github releases: {}", e))?;-- /*- println!("Status: {} {}", _res.status_code(), _res.reason());- println!("{}", String::from_utf8_lossy(&latest));- */-- let latest: Release = serde_json::from_slice(&latest)?;- Ok(latest)-}--pub fn get_latest_release_info() -> anyhow::Result<Release> {- get_github_release_info("https://api.github.com/repos/RoversX/thinkterm/releases/latest")-}--#[allow(unused)]-pub fn get_nightly_release_info() -> anyhow::Result<Release> {- get_github_release_info("https://api.github.com/repos/RoversX/thinkterm/releases/tags/nightly")-}+// The release lookup, the running version and the version comparison are+// shared with `thinkterm update` and the mux client's remote update; the GUI+// keeps its names for them so the Settings pages and the toast read the same.+pub use thinkterm_update::{+ get_latest_release_info, is_newer_release, release_tag_url, releases_url,+ running_release_version, Release, REPO_URL,+};lazy_static::lazy_static! {static ref UPDATER_WINDOW: Mutex<Option<ConnectionUI>> = Mutex::new(None);}-pub fn load_last_release_info_and_set_banner() {- if !configuration().check_for_updates {- return;- }-- let update_file_name = config::DATA_DIR.join("check_update");- if let Ok(data) = std::fs::read(update_file_name) {- let latest: Release = match serde_json::from_slice(&data) {- Ok(d) => d,- Err(_) => return,- };-- let current = running_release_version();- let force_ui = always_show_update_ui();- if !is_newer_release(&latest.tag_name, ¤t) && !force_ui {- return;- }-- set_banner_from_release_info(&latest);- }-}--fn set_banner_from_release_info(latest: &Release) {- let mux = crate::Mux::get();- let url = release_tag_url(&latest.tag_name);-- let icon = ITermFileData {- name: None,- size: Some(ICON_DATA.len()),- width: ITermDimension::Automatic,- height: ITermDimension::Cells(2),- preserve_aspect_ratio: true,- inline: true,- do_not_move_cursor: false,- data: ICON_DATA.to_vec(),- };- let icon = OperatingSystemCommand::ITermProprietary(ITermProprietary::File(Box::new(icon)));- let top_line_pos = CSI::Cursor(Cursor::CharacterAndLinePosition {- line: OneBased::new(1),- col: OneBased::new(6),- });- let second_line_pos = CSI::Cursor(Cursor::CharacterAndLinePosition {- line: OneBased::new(2),- col: OneBased::new(6),- });- let link_on = OperatingSystemCommand::SetHyperlink(Some(Hyperlink::new(url)));- let underline_color = CSI::Sgr(Sgr::UnderlineColor(AnsiColor::Blue.into()));- let underline_on = CSI::Sgr(Sgr::Underline(Underline::Single));- let reset = CSI::Sgr(Sgr::Reset);- let link_off = OperatingSystemCommand::SetHyperlink(None);- mux.set_banner(Some(format!(- "{}{}ThinkTerm Update Available\r\n{}{}{}{}Click to see what's new{}{}\r\n",- icon,- top_line_pos,- second_line_pos,- link_on,- underline_color,- underline_on,- link_off,- reset,- )));-}--fn schedule_set_banner_from_release_info(latest: &Release) {- let current = running_release_version();- if !is_newer_release(&latest.tag_name, ¤t) {- return;- }- promise::spawn::spawn_into_main_thread({- let latest = latest.clone();- async move {- set_banner_from_release_info(&latest);- }- })- .detach();-}--/// The release version of the running build, for comparison against the tag-/// of the latest GitHub release.+/// Whether a release newer than this build is known. What the sidebar's+/// settings button reads on every paint, so it is a flag and not a file:+/// set from the cache at startup and by the checker after every check.///-/// `wezterm_version()` is baked in at compile time from `.tag`, which only the-/// release workflow writes -- and macOS is the one platform whose packages are-/// built by hand rather than in CI, so its binaries carry a commit stamp that-/// `is_newer_release` deliberately refuses to compare against a `v*` tag. The-/// bundle's Info.plist does carry the release version, is read at runtime-/// rather than compile time, and is already what Finder and the About panel-/// show, so prefer it when we are running from inside an app bundle.-pub fn running_release_version() -> String {- #[cfg(target_os = "macos")]- {- if let Some(version) = macos_bundle_version() {- return version;- }- }- wezterm_version().to_string()-}--/// `<bundle>.app/Contents/MacOS/<exe>` puts Info.plist one level up from the-/// executable's directory. Returns None for a bare `cargo build` binary, which-/// has no bundle and should keep reporting its commit stamp.-#[cfg(target_os = "macos")]-fn macos_bundle_version() -> Option<String> {- let exe = std::env::current_exe().ok()?;- version_from_info_plist(exe.parent()?.parent()?.join("Info.plist"))-}--#[cfg(target_os = "macos")]-fn version_from_info_plist(path: std::path::PathBuf) -> Option<String> {- let value = plist::Value::from_file(path).ok()?;- let version = value- .as_dictionary()?- .get("CFBundleShortVersionString")?- .as_string()?- .trim()- .to_string();- if version.is_empty() {- None- } else {- Some(version)+/// Nothing is written into terminal output any more. The upstream banner+/// printed two rows and an icon into every new local shell and left them in+/// its scrollback; a dot on the settings button says the same thing without+/// taking any space, on remote panes too, and leads to the page that can+/// act on it.+static UPDATE_AVAILABLE: AtomicBool = AtomicBool::new(false);++pub fn update_available() -> bool {+ UPDATE_AVAILABLE.load(Ordering::Relaxed)+}++/// Record the flag; when it changes, ask every window to repaint so the dot+/// appears or goes away. Only the checker thread calls this: it runs once+/// the GUI is up, and spawning onto the main thread needs its scheduler.+fn set_update_available(available: bool) {+ let was = UPDATE_AVAILABLE.swap(available, Ordering::Relaxed);+ if was != available {+ promise::spawn::spawn_into_main_thread(async move {+ crate::frontend::front_end().invalidate_all_windows();+ })+ .detach();}}-/// Is `latest` a release the running build should be told about?-///-/// The two strings only compare meaningfully when they use the same scheme.-/// A CI build carries the release tag (the workflow writes `.tag`, which-/// wezterm-version's build.rs prefers); anything built from a plain checkout-/// carries a `<date>-<hash>` commit stamp instead. Comparing across the two-/// with `>` is what made every `v*` release look permanently newer than every-/// local build: 'v' sorts above every digit, so the banner never went away.-fn is_newer_release(latest: &str, current: &str) -> bool {- let parse = |s: &str| semver::Version::parse(s.trim_start_matches('v')).ok();- match (parse(latest), parse(current)) {- (Some(latest), Some(current)) => latest > current,- // Both on the commit-stamp scheme, which upstream still uses for its- // own tags. It starts with a zero-padded date, so lexicographic order- // is chronological order.- (None, None) => latest > current,- // One of each: there is no ordering between the schemes, and a build- // that never came from a release is not something to nag about.- _ => false,+/// Seed the flag from the last check on disk, so the dot is right from the+/// first frame rather than after the checker's first delay. Called before+/// any window exists, so it only stores: the first paint reads it.+pub fn load_last_release_info() {+ if !configuration().check_for_updates {+ return;}+ let status = cached_update_status();+ UPDATE_AVAILABLE.store(+ status.update_available || always_show_update_ui(),+ Ordering::Relaxed,+ );}/// Everything the Settings > Update page can say without touching the network.@@ -301,21 +138,6 @@ mod update_version_tests {assert!(!is_newer_release("20260101-000000-aaaaaaaa", STAMP));}- /// The bundle template is the version a hand-built macOS package reports,- /// so a release that forgets to bump it silently stops notifying users.- #[cfg(target_os = "macos")]- #[test]- fn bundle_template_carries_a_comparable_version() {- let plist = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))- .join("../assets/macos/ThinkTerm.app/Contents/Info.plist");- let version = super::version_from_info_plist(plist)- .expect("the shipped Info.plist must declare CFBundleShortVersionString");- assert!(- semver::Version::parse(version.trim_start_matches('v')).is_ok(),- "Info.plist version {version:?} must parse as semver, or macOS \- builds cannot be compared against a release tag"- );- }}/// Returns true if the provided socket path is dead.@@ -355,9 +177,10 @@ fn update_checker() {if configuration().check_for_updates {if let Ok(latest) = get_latest_release_info() {- schedule_set_banner_from_release_info(&latest);let current = running_release_version();- if is_newer_release(&latest.tag_name, ¤t) || force_ui {+ let newer = is_newer_release(&latest.tag_name, ¤t);+ set_update_available(newer || force_ui);+ if newer || force_ui {log::info!("latest release {} is newer than current build {}",latest.tag_name,@@ -368,8 +191,8 @@ fn update_checker() {if force_ui || socks.is_empty() || socks[0] == my_sock {persistent_toast_notification_with_click_to_open_url(- "ThinkTerm Update Available",- "Click to see what's new",+ &crate::i18n::tr("update-toast-title"),+ &crate::i18n::tr("update-toast-body"),&url,);}