Skip to content

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.

feat(settings): choose where updates download from

RoversX0dcd4057f0ff
diff --git a/thinkterm-i18n/i18n/de-DE.ftl b/thinkterm-i18n/i18n/de-DE.ftl
index 2447ea0a..e4c6da12 100644
--- a/thinkterm-i18n/i18n/de-DE.ftl
+++ b/thinkterm-i18n/i18n/de-DE.ftl
@@ -162,6 +162,10 @@ settings-system-notifications = Systembenachrichtigungen
settings-system-notifications-description = Benachrichtigt, solange ThinkTerm im Hintergrund ist, wenn ein Thread fertig ist, Sie braucht oder mit einem Fehler anhält.
settings-remote-update-keep-sessions = Sitzungen beim Update eines Remote-Servers behalten
settings-remote-update-keep-sessions-description = Der laufende Server übergibt seine Panes an die neue Version, statt zu stoppen; nichts, was darin läuft, endet.
+settings-update-download-source = Downloadquelle
+settings-update-download-source-description = Woher Updates das Release laden, hier und auf Remote-Servern. Wähle einen Mirror, wo GitHub langsam oder gesperrt ist; egal woher die Datei kommt, sie wird nur installiert, wenn sie zur Prüfsumme passt, die GitHub hinterlegt hat.
+settings-update-download-source-direct = GitHub (direkt)
+settings-update-download-source-auto = Automatisch
settings-local-sessions-via-mux = Lokale Terminals in einem Hintergrund-Sitzungsserver halten
settings-local-sessions-via-mux-description = Lokale Terminals laufen in einem Mux-Server auf diesem Rechner und überstehen das Beenden, Abstürzen oder Aktualisieren von ThinkTerm. Wird beim nächsten Start von ThinkTerm wirksam.
settings-local-sessions-via-mux-description-windows = Lokale Terminals laufen in einem Mux-Server auf diesem Rechner und überstehen das Beenden oder Abstürzen von ThinkTerm. Eine Aktualisierung von ThinkTerm beendet den Server. Wird beim nächsten Start von ThinkTerm wirksam.
diff --git a/thinkterm-i18n/i18n/en-US.ftl b/thinkterm-i18n/i18n/en-US.ftl
index 606d1121..31282bd8 100644
--- a/thinkterm-i18n/i18n/en-US.ftl
+++ b/thinkterm-i18n/i18n/en-US.ftl
@@ -162,6 +162,10 @@ settings-system-notifications = System Notifications
settings-system-notifications-description = While ThinkTerm is in the background, notify when a thread finishes, needs you, or stops on an error.
settings-remote-update-keep-sessions = Keep sessions when updating a remote server
settings-remote-update-keep-sessions-description = The running server hands its panes to the new version instead of stopping; nothing running in them ends.
+settings-update-download-source = Download source
+settings-update-download-source-description = Where updates download the release from, here and on remote servers. Pick a mirror where GitHub is slow or blocked; whatever serves the file, it is installed only if it matches the checksum GitHub recorded.
+settings-update-download-source-direct = GitHub (direct)
+settings-update-download-source-auto = Automatic
settings-local-sessions-via-mux = Keep local terminals in a background session server
settings-local-sessions-via-mux-description = Local terminals run in a mux server on this machine and survive quitting, crashing or updating ThinkTerm. Takes effect the next time ThinkTerm starts.
settings-local-sessions-via-mux-description-windows = Local terminals run in a mux server on this machine and survive quitting or crashing ThinkTerm. Updating ThinkTerm stops the server. Takes effect the next time ThinkTerm starts.
diff --git a/thinkterm-i18n/i18n/fr-FR.ftl b/thinkterm-i18n/i18n/fr-FR.ftl
index 81b711d1..de5a957a 100644
--- a/thinkterm-i18n/i18n/fr-FR.ftl
+++ b/thinkterm-i18n/i18n/fr-FR.ftl
@@ -162,6 +162,10 @@ settings-system-notifications = Notifications système
settings-system-notifications-description = Quand ThinkTerm est en arrière-plan, prévenir lorsqu’une session se termine, vous attend ou s’arrête sur une erreur.
settings-remote-update-keep-sessions = Conserver les sessions lors de la mise à jour d’un serveur distant
settings-remote-update-keep-sessions-description = Le serveur en cours transmet ses panneaux à la nouvelle version au lieu de s’arrêter ; rien de ce qui y tourne ne s’interrompt.
+settings-update-download-source = Source de téléchargement
+settings-update-download-source-description = D’où les mises à jour téléchargent la version, ici et sur les serveurs distants. Choisissez un miroir là où GitHub est lent ou bloqué ; quelle que soit la source, le fichier n’est installé que s’il correspond à la somme de contrôle enregistrée par GitHub.
+settings-update-download-source-direct = GitHub (direct)
+settings-update-download-source-auto = Automatique
settings-local-sessions-via-mux = Garder les terminaux locaux dans un serveur de sessions en arrière-plan
settings-local-sessions-via-mux-description = Les terminaux locaux tournent dans un serveur mux sur cette machine et survivent à la fermeture, au plantage ou à la mise à jour de ThinkTerm. Prend effet au prochain lancement.
settings-local-sessions-via-mux-description-windows = Les terminaux locaux tournent dans un serveur mux sur cette machine et survivent à la fermeture ou au plantage de ThinkTerm. Mettre à jour ThinkTerm arrête le serveur. Prend effet au prochain lancement.
diff --git a/thinkterm-i18n/i18n/ja-JP.ftl b/thinkterm-i18n/i18n/ja-JP.ftl
index fae6cbcb..5b7682cf 100644
--- a/thinkterm-i18n/i18n/ja-JP.ftl
+++ b/thinkterm-i18n/i18n/ja-JP.ftl
@@ -159,6 +159,10 @@ settings-system-notifications = システム通知
settings-system-notifications-description = ThinkTerm がバックグラウンドにあるとき、スレッドが完了した・対応待ちになった・エラーで止まったときに通知します。
settings-remote-update-keep-sessions = リモートサーバー更新時にセッションを維持
settings-remote-update-keep-sessions-description = 実行中のサーバーは停止せず、ペインを新しいバージョンに引き継ぎます。実行中の処理は中断されません。
+settings-update-download-source = ダウンロード元
+settings-update-download-source-description = 更新時にリリースをどこからダウンロードするか。このマシンとリモートサーバーの両方で使います。GitHub が遅いかつながらない場合はミラーを選べます。どこから取得しても、GitHub が記録したチェックサムと一致した場合だけインストールします。
+settings-update-download-source-direct = GitHub(直接)
+settings-update-download-source-auto = 自動
settings-local-sessions-via-mux = ローカル端末をバックグラウンドのセッションサーバーに置く
settings-local-sessions-via-mux-description = ローカル端末はこのマシンの mux サーバーで動作し、ThinkTerm の終了・クラッシュ・更新後も残ります。次回起動時に有効になります。
settings-local-sessions-via-mux-description-windows = ローカル端末はこのマシンの mux サーバーで動作し、ThinkTerm の終了・クラッシュ後も残ります。ThinkTerm を更新するとサーバーは停止します。次回起動時に有効になります。
diff --git a/thinkterm-i18n/i18n/zh-CN.ftl b/thinkterm-i18n/i18n/zh-CN.ftl
index cd5160a3..3dc9e47f 100644
--- a/thinkterm-i18n/i18n/zh-CN.ftl
+++ b/thinkterm-i18n/i18n/zh-CN.ftl
@@ -159,6 +159,10 @@ settings-system-notifications = 系统通知
settings-system-notifications-description = ThinkTerm 在后台时,线程做完、等你处理或出错停下时发系统通知。
settings-remote-update-keep-sessions = 更新远端 server 时保留会话
settings-remote-update-keep-sessions-description = 运行中的 server 把 pane 交给新版本而不是停掉,里面跑的程序不会中断。
+settings-update-download-source = 下载来源
+settings-update-download-source-description = 更新从哪里下载安装包,本机和远端 server 都用它。GitHub 慢或连不上时可以选镜像;不管从哪里下载,都要和 GitHub 记录的校验值一致才会安装。
+settings-update-download-source-direct = 直连 GitHub
+settings-update-download-source-auto = 自动
settings-local-sessions-via-mux = 本地终端放在后台会话 server 里
settings-local-sessions-via-mux-description = 本地终端跑在本机的 mux server 中,ThinkTerm 退出、崩溃或更新后会话仍在。下次启动 ThinkTerm 时生效。
settings-local-sessions-via-mux-description-windows = 本地终端跑在本机的 mux server 中,ThinkTerm 退出或崩溃后会话仍在;更新 ThinkTerm 会停止该 server。下次启动 ThinkTerm 时生效。
diff --git a/wezterm-gui/src/main.rs b/wezterm-gui/src/main.rs
index d96e64f3..885733e8 100644
--- a/wezterm-gui/src/main.rs
+++ b/wezterm-gui/src/main.rs
@@ -1478,6 +1478,9 @@ fn run_terminal_gui(opts: StartCommand, default_domain_name: Option<String>) ->
wezterm_client::remote_update::set_keep_sessions_on_update(
crate::native_settings::remote_update_keeps_sessions(),
);
+ thinkterm_update::set_download_source(crate::native_settings::update_download_source(
+ &crate::native_settings::load_shared(),
+ ));
thinkterm_update::set_transport(crate::update::reqwest_transport);
wezterm_client::domain::set_local_session_host_replaced_sink(
crate::local_sessions::on_host_replaced,
diff --git a/wezterm-gui/src/native_settings.rs b/wezterm-gui/src/native_settings.rs
index e4e125a0..3eb7f089 100644
--- a/wezterm-gui/src/native_settings.rs
+++ b/wezterm-gui/src/native_settings.rs
@@ -1127,6 +1127,11 @@ pub(crate) struct NativeWorkspaceSettings {
/// Updating a remote mux server hands its sessions to the new version
/// instead of stopping it; off, the update asks whether to stop it.
pub(crate) remote_update_keeps_sessions: bool,
+ /// Where updates download the release from, as
+ /// `thinkterm_update::DownloadSource` names it: "auto" (the default),
+ /// "direct" (GitHub only) or a mirror's host. An unknown name is the
+ /// default. The CLI and the mux server read it from this file.
+ pub(crate) update_download_source: String,
/// Local terminals run in a background mux server (the default unix
/// domain) instead of inside the GUI process, so they survive the GUI
/// quitting, crashing or updating. Read once at launch.
@@ -1142,6 +1147,7 @@ impl Default for NativeWorkspaceSettings {
notification_sounds_enabled: true,
system_notifications_enabled: true,
remote_update_keeps_sessions: true,
+ update_download_source: thinkterm_update::DownloadSource::Auto.name().to_string(),
// Preserve the behavior of older settings files without this field.
// Fresh installs enable it in ThinkTermNativeSettings::for_new_install.
local_sessions_via_mux: false,
@@ -2018,6 +2024,9 @@ fn apply_external_change(before: &ThinkTermNativeSettings, after: &ThinkTermNati
after.workspaces.remote_update_keeps_sessions,
);
}
+ if before.workspaces.update_download_source != after.workspaces.update_download_source {
+ thinkterm_update::set_download_source(update_download_source(after));
+ }
}
/// Where the main window should reopen, or `None` if nothing has been
@@ -2717,6 +2726,12 @@ pub(crate) fn remote_update_keeps_sessions() -> bool {
load().workspaces.remote_update_keeps_sessions
}
+pub(crate) fn update_download_source(
+ settings: &ThinkTermNativeSettings,
+) -> thinkterm_update::DownloadSource {
+ thinkterm_update::DownloadSource::from_name(&settings.workspaces.update_download_source)
+}
+
pub(crate) fn local_sessions_via_mux() -> bool {
load().workspaces.local_sessions_via_mux
}
diff --git a/wezterm-gui/src/settings_window.rs b/wezterm-gui/src/settings_window.rs
index c83b4166..cd455fa8 100644
--- a/wezterm-gui/src/settings_window.rs
+++ b/wezterm-gui/src/settings_window.rs
@@ -1508,6 +1508,15 @@ fn shell_catalog_including(
catalog
}
+fn download_source_label(source: thinkterm_update::DownloadSource) -> String {
+ use thinkterm_update::DownloadSource;
+ match source {
+ DownloadSource::Direct => crate::i18n::tr("settings-update-download-source-direct"),
+ DownloadSource::Auto => crate::i18n::tr("settings-update-download-source-auto"),
+ DownloadSource::Mirror(host) => host.to_string(),
+ }
+}
+
fn localized_remote_pane_resize_mode_label(mode: NativeRemotePaneResizeMode) -> String {
crate::i18n::tr(match mode {
NativeRemotePaneResizeMode::Auto => "settings-remote-pane-resize-mode-auto",
@@ -1825,6 +1834,8 @@ enum SettingsAction {
WindowOpacitySlider,
ToggleMainRendererMenu,
SetMainRenderer(NativeRendererBackend),
+ ToggleDownloadSourceMenu,
+ SetDownloadSource(thinkterm_update::DownloadSource),
/// Swallows clicks that land in an open dropdown's padding or row
/// gaps instead of letting them reach the controls underneath.
DropdownMenuBackdrop,
@@ -1956,6 +1967,8 @@ enum SettingsDrag {
enum SettingsDropdown {
Language,
MainRenderer,
+ /// Where updates download the release from, on the Updates page.
+ DownloadSource,
DefaultShell,
CommandPaletteHotkey,
WebLinkTtl,
@@ -4035,6 +4048,8 @@ impl SettingsWindow {
| SettingsAction::SetAppIcon(_)
| SettingsAction::ToggleMainRendererMenu
| SettingsAction::SetMainRenderer(_)
+ | SettingsAction::ToggleDownloadSourceMenu
+ | SettingsAction::SetDownloadSource(_)
| SettingsAction::ToggleDefaultShellMenu
| SettingsAction::SetDefaultShell(_)
| SettingsAction::ToggleCommandPaletteHotkeyMenu
@@ -6055,6 +6070,30 @@ impl SettingsWindow {
}
}
}
+ SettingsAction::ToggleDownloadSourceMenu => {
+ self.ui.open_dropdown =
+ if self.ui.open_dropdown == Some(SettingsDropdown::DownloadSource) {
+ None
+ } else {
+ Some(SettingsDropdown::DownloadSource)
+ };
+ }
+ SettingsAction::SetDownloadSource(source) => {
+ self.ui.open_dropdown = None;
+ self.native_settings.workspaces.update_download_source = source.name().to_string();
+ thinkterm_update::set_download_source(source);
+ let setting = crate::i18n::tr("settings-update-download-source");
+ self.status = match crate::native_settings::save(&self.native_settings) {
+ Ok(()) => settings_tr(
+ "settings-status-value-now",
+ &[("setting", setting), ("value", download_source_label(source))],
+ ),
+ Err(err) => settings_tr(
+ "settings-status-save-error",
+ &[("setting", setting), ("error", format!("{err:#}"))],
+ ),
+ };
+ }
SettingsAction::DropdownMenuBackdrop => {
// Deliberately inert: the click was inside the open menu
// but not on an option, so it selects nothing and the menu
@@ -15731,11 +15770,24 @@ impl SettingsWindow {
self.paint_compact_row(layers, tx, row_y, tw, label, value, index > 0)?;
}
- // One choice: what updating a remote server does to its sessions.
+ // Two choices: where updates download from, and what updating a
+ // remote server does to its sessions.
let toggle_card_y = card_y + card_height + gap;
- let toggle_card_height = self.compact_card_height(1);
+ let toggle_card_height = self.compact_card_height(2);
self.paint_group_card(layers, x, toggle_card_y, max_width, toggle_card_height)?;
- let toggle_row_y = toggle_card_y + self.ui_px(12.0);
+ let source_row_y = toggle_card_y + self.ui_px(12.0);
+ let (tx, tw) = self.paint_band_tile(
+ layers,
+ row_x,
+ source_row_y,
+ row_step,
+ row_width,
+ SvgIcon::Download,
+ TileColor::Teal,
+ )?;
+ self.paint_download_source_row(layers, tx, source_row_y, tw, row_step)?;
+ let toggle_row_y = source_row_y + row_step;
+ self.paint_separator(layers, tx, toggle_row_y, tw)?;
let (tx, tw) = self.paint_band_tile(
layers,
row_x,
@@ -18049,6 +18101,12 @@ impl SettingsWindow {
control_y + self.ui_px(CONTROL_HEIGHT) + self.ui_px(8.0),
control_width,
),
+ SettingsDropdown::DownloadSource => self.paint_download_source_menu(
+ layers,
+ control_x,
+ control_y + self.ui_px(CONTROL_HEIGHT) + self.ui_px(8.0),
+ control_width,
+ ),
SettingsDropdown::DefaultShell => self.paint_default_shell_menu(
layers,
control_x,
@@ -18099,6 +18157,86 @@ impl SettingsWindow {
self.paint_dropdown_menu(layers, x, y, width, &options)
}
+ fn paint_download_source_menu(
+ &mut self,
+ layers: &mut TripleLayerQuadAllocator<'_>,
+ x: f32,
+ y: f32,
+ width: f32,
+ ) -> anyhow::Result<()> {
+ let current = crate::native_settings::update_download_source(&self.native_settings);
+ let options: Vec<(String, SettingsAction, bool)> = thinkterm_update::DownloadSource::all()
+ .map(|source| {
+ (
+ download_source_label(source),
+ SettingsAction::SetDownloadSource(source),
+ source == current,
+ )
+ })
+ .collect();
+ self.paint_dropdown_menu(layers, x, y, width, &options)
+ }
+
+ /// The Updates page's download source: a hinted label and a dropdown,
+ /// both centred in a single-line band like the toggle under it.
+ fn paint_download_source_row(
+ &mut self,
+ layers: &mut TripleLayerQuadAllocator<'_>,
+ x: f32,
+ y: f32,
+ width: f32,
+ band_height: f32,
+ ) -> anyhow::Result<()> {
+ let palette = self.palette();
+ let control_width = self.settings_control_width(width);
+ let control_x = x + width - control_width;
+ let control_height = self.ui_px(CONTROL_HEIGHT);
+ let control_y = y + ((band_height - control_height) / 2.0).max(0.0);
+ self.note_dropdown_anchor(
+ SettingsDropdown::DownloadSource,
+ (control_x, control_y, control_width),
+ );
+ let action = SettingsAction::ToggleDownloadSourceMenu;
+ let label = download_source_label(crate::native_settings::update_download_source(
+ &self.native_settings,
+ ));
+ let control_rect = self.dropdown_pill_rect(control_x, control_y, control_width, &label);
+ let open = self.ui.open_dropdown == Some(SettingsDropdown::DownloadSource);
+ let hovered = self.ui.interaction.hovered == Some(action);
+ let pressed = self.ui.interaction.pressed == Some(action);
+ let bg = if pressed || hovered {
+ palette.control_hover_bg
+ } else {
+ palette.control_bg
+ };
+ let border = if open {
+ palette.nav_selected_bg
+ } else if hovered || pressed {
+ palette.separator
+ } else {
+ palette.control_border
+ };
+ self.ui_context
+ .push(control_rect, WidgetKind::Button, action);
+
+ let cell_height = self.metrics.cell_size.height as f32;
+ let icon_size = self.ui_px(HINT_ICON_SIDE);
+ let icon_gap = self.ui_px(HINT_ICON_GAP);
+ let text_width =
+ (control_rect.min_x() - x - icon_size - icon_gap - 24.0).max(width * 0.3);
+ let label_y = control_y + (control_height - cell_height) / 2.0;
+ self.paint_hinted_label(
+ layers,
+ x,
+ label_y,
+ text_width,
+ &crate::i18n::tr("settings-update-download-source"),
+ "settings-update-download-source-description",
+ )?;
+ self.paint_dropdown_pill(layers, control_rect, &label, bg, border)?;
+ Ok(())
+ }
+
fn paint_main_renderer_menu(
&mut self,
layers: &mut TripleLayerQuadAllocator<'_>,