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.

Fall back to OpenGL when WebGpu cannot start, plus UI defaults

RoversX43100fec9d00
diff --git a/config/src/frontend.rs b/config/src/frontend.rs
index 7a99ab8f..73ab8ed3 100644
--- a/config/src/frontend.rs
+++ b/config/src/frontend.rs
@@ -3,8 +3,12 @@ use wezterm_dynamic::{FromDynamic, ToDynamic};
#[derive(Debug, Clone, Copy, PartialEq, Eq, FromDynamic, ToDynamic, Default)]
pub enum FrontEndSelection {
- #[default]
OpenGL,
+ /// The default since the main window learned to fall back: wgpu asks for
+ /// every backend it has (Metal, then DX12/Vulkan/GL depending on the
+ /// platform), and if none of them can be brought up the window quietly
+ /// opens on OpenGL instead of failing to open at all.
+ #[default]
WebGpu,
Software,
}
diff --git a/wezterm-gui/i18n/en-US.ftl b/wezterm-gui/i18n/en-US.ftl
index 122d0bc9..43fa72d1 100644
--- a/wezterm-gui/i18n/en-US.ftl
+++ b/wezterm-gui/i18n/en-US.ftl
@@ -185,6 +185,13 @@ sidebar-pinned = Pinned
sidebar-collection-threads = Threads
sidebar-workspaces = Workspaces
sidebar-settings = Settings
+# Hover tags on the icon-only sidebar buttons. Keep these to a couple of
+# words: they are labels for an icon, not descriptions.
+tooltip-sidebar-settings = Settings
+tooltip-sidebar-view-options = View Options
+tooltip-sidebar-ssh-hosts = SSH Hosts
+tooltip-sidebar-live-overview = Live Overview
+tooltip-sidebar-notifications = Notifications
menu-rename-project = Rename Project…
menu-new-thread = New Thread
menu-toggle-threads = Collapse / Expand Threads
@@ -458,6 +465,8 @@ onboarding-appearance = Appearance
onboarding-theme-system = Follow System
onboarding-theme-light = Light
onboarding-theme-dark = Dark
+# Shown under the theme tiles only while Follow System or Light is selected.
+onboarding-theme-light-note = Bold choice — most terminals never see daylight.
onboarding-privacy = Nothing you open leaves this machine.
onboarding-skip = Skip
onboarding-start = Get Started
diff --git a/wezterm-gui/i18n/fr-FR.ftl b/wezterm-gui/i18n/fr-FR.ftl
index 66c292d8..3dc9d764 100644
--- a/wezterm-gui/i18n/fr-FR.ftl
+++ b/wezterm-gui/i18n/fr-FR.ftl
@@ -185,6 +185,13 @@ sidebar-pinned = Épinglées
sidebar-collection-threads = Sessions
sidebar-workspaces = Espaces de travail
sidebar-settings = Réglages
+# Hover tags on the icon-only sidebar buttons. Keep these to a couple of
+# words: they are labels for an icon, not descriptions.
+tooltip-sidebar-settings = Réglages
+tooltip-sidebar-view-options = Options d'affichage
+tooltip-sidebar-ssh-hosts = Hôtes SSH
+tooltip-sidebar-live-overview = Aperçu en direct
+tooltip-sidebar-notifications = Notifications
menu-rename-project = Renommer le projet…
menu-new-thread = Nouvelle session
menu-toggle-threads = Réduire / développer les sessions
@@ -458,6 +465,8 @@ onboarding-appearance = Apparence
onboarding-theme-system = Suivre le système
onboarding-theme-light = Clair
onboarding-theme-dark = Sombre
+# Shown under the theme tiles only while Follow System or Light is selected.
+onboarding-theme-light-note = Choix audacieux — la plupart des terminaux ne voient jamais le jour.
onboarding-privacy = Rien de ce que vous ouvrez ne quitte cet appareil.
onboarding-skip = Ignorer
onboarding-start = Commencer
diff --git a/wezterm-gui/i18n/ja-JP.ftl b/wezterm-gui/i18n/ja-JP.ftl
index 7f553bce..4ca897ec 100644
--- a/wezterm-gui/i18n/ja-JP.ftl
+++ b/wezterm-gui/i18n/ja-JP.ftl
@@ -185,6 +185,13 @@ sidebar-pinned = ピン留め
sidebar-collection-threads = セッション
sidebar-workspaces = ワークスペース
sidebar-settings = 設定
+# Hover tags on the icon-only sidebar buttons. Keep these to a couple of
+# words: they are labels for an icon, not descriptions.
+tooltip-sidebar-settings = 設定
+tooltip-sidebar-view-options = 表示オプション
+tooltip-sidebar-ssh-hosts = SSH ホスト
+tooltip-sidebar-live-overview = ライブ概要
+tooltip-sidebar-notifications = 通知
menu-rename-project = プロジェクト名を変更…
menu-new-thread = 新しいセッション
menu-toggle-threads = セッションを折りたたむ/展開
@@ -458,6 +465,8 @@ onboarding-appearance = 外観
onboarding-theme-system = システムに合わせる
onboarding-theme-light = ライト
onboarding-theme-dark = ダーク
+# Shown under the theme tiles only while Follow System or Light is selected.
+onboarding-theme-light-note = 勇気ある選択です。ほとんどの端末は日の光を知りません。
onboarding-privacy = 開いたものはこの端末の外に出ません。
onboarding-skip = スキップ
onboarding-start = 使ってみる
diff --git a/wezterm-gui/i18n/zh-CN.ftl b/wezterm-gui/i18n/zh-CN.ftl
index b0ca6be2..0452f379 100644
--- a/wezterm-gui/i18n/zh-CN.ftl
+++ b/wezterm-gui/i18n/zh-CN.ftl
@@ -185,6 +185,13 @@ sidebar-pinned = 已置顶
sidebar-collection-threads = 会话
sidebar-workspaces = 工作区
sidebar-settings = 设置
+# Hover tags on the icon-only sidebar buttons. Keep these to a couple of
+# words: they are labels for an icon, not descriptions.
+tooltip-sidebar-settings = 设置
+tooltip-sidebar-view-options = 视图选项
+tooltip-sidebar-ssh-hosts = SSH 主机
+tooltip-sidebar-live-overview = 实时总览
+tooltip-sidebar-notifications = 通知
menu-rename-project = 重命名项目…
menu-new-thread = 新建会话
menu-toggle-threads = 折叠 / 展开会话
@@ -458,6 +465,8 @@ onboarding-appearance = 外观
onboarding-theme-system = 跟随系统
onboarding-theme-light = 浅色
onboarding-theme-dark = 深色
+# Shown under the theme tiles only while Follow System or Light is selected.
+onboarding-theme-light-note = 很有勇气 —— 大多数终端从不见光。
onboarding-privacy = 你打开的一切都不会离开这台设备。
onboarding-skip = 跳过
onboarding-start = 开始使用
diff --git a/wezterm-gui/src/native_settings.rs b/wezterm-gui/src/native_settings.rs
index fa5b30b7..fc60be23 100644
--- a/wezterm-gui/src/native_settings.rs
+++ b/wezterm-gui/src/native_settings.rs
@@ -50,7 +50,11 @@ pub(crate) enum NativeThemeMode {
impl Default for NativeThemeMode {
fn default() -> Self {
- Self::System
+ // Dark rather than Follow System: a terminal spends its life next to
+ // other terminals, and following a light desktop theme is the one
+ // default nobody keeps. Existing installs are unaffected — their
+ // settings.json already records an explicit theme_mode.
+ Self::Dark
}
}
diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs
index 4d8a0811..0fc61f7d 100644
--- a/wezterm-gui/src/termwindow/mod.rs
+++ b/wezterm-gui/src/termwindow/mod.rs
@@ -309,6 +309,11 @@ const CHROME_RETURN_DELAY: Duration = Duration::from_millis(90);
/// the grid that is arriving underneath it.
pub(crate) const CONTENT_VIEW_FLIGHT_ZINDEX: i8 = 9;
+/// Above every other chrome surface, including the content-view flight layer.
+/// A hover tag explains a button that sits at the edge of a sidebar, so it
+/// necessarily overhangs that sidebar and must not be painted underneath it.
+pub(crate) const TOOLTIP_ZINDEX: i8 = 10;
+
/// Z-index a transitioning full-window view is composited into.
///
/// Everything else in the window draws at zero. The quad layers within a
@@ -1054,6 +1059,45 @@ pub(crate) fn pane_drop_action(
}
}
+#[cfg(test)]
+mod tooltip_tests {
+ use super::*;
+
+ #[test]
+ fn every_icon_only_sidebar_button_has_a_name() {
+ // These five carry no text of their own, so the hover tag is the only
+ // place their name appears.
+ for item_type in [
+ UIItemType::WorkspaceSidebarSettings,
+ UIItemType::WorkspaceSidebarViewOptions,
+ UIItemType::WorkspaceSidebarSshHosts,
+ UIItemType::WorkspaceSidebarLiveOverview,
+ UIItemType::WorkspaceSidebarNotifications,
+ ] {
+ let label = tooltip_label_for(&item_type)
+ .unwrap_or_else(|| panic!("no tooltip label for {:?}", item_type));
+ assert!(!label.is_empty(), "empty tooltip label for {:?}", item_type);
+ // A missing translation surfaces as the key itself.
+ assert!(
+ !label.starts_with("tooltip-"),
+ "untranslated tooltip label {:?}",
+ label
+ );
+ }
+ }
+
+ #[test]
+ fn rows_that_already_show_their_own_text_get_no_tag() {
+ for item_type in [
+ UIItemType::SpaceMenu,
+ UIItemType::WorkspaceSidebarBackground,
+ UIItemType::Project("p".to_string()),
+ ] {
+ assert!(tooltip_label_for(&item_type).is_none(), "{:?}", item_type);
+ }
+ }
+}
+
#[cfg(test)]
mod pane_drop_tests {
use super::*;
@@ -1203,6 +1247,33 @@ pub struct UIItem {
pub item_type: UIItemType,
}
+/// How long the pointer must rest on an icon-only button before its name
+/// appears. Long enough that crossing the sidebar on the way somewhere else
+/// shows nothing.
+pub const TOOLTIP_DELAY: Duration = Duration::from_millis(500);
+
+/// A pending or visible hover tag: which button, where it sits, and when the
+/// pointer arrived.
+#[derive(Clone, Debug)]
+pub struct HoverTooltip {
+ pub item: UIItem,
+ pub since: Instant,
+}
+
+/// The name to show for an icon-only button, or `None` for everything that
+/// already carries its own label (or whose meaning is obvious from position).
+pub fn tooltip_label_for(item_type: &UIItemType) -> Option<String> {
+ let key = match item_type {
+ UIItemType::WorkspaceSidebarSettings => "tooltip-sidebar-settings",
+ UIItemType::WorkspaceSidebarViewOptions => "tooltip-sidebar-view-options",
+ UIItemType::WorkspaceSidebarSshHosts => "tooltip-sidebar-ssh-hosts",
+ UIItemType::WorkspaceSidebarLiveOverview => "tooltip-sidebar-live-overview",
+ UIItemType::WorkspaceSidebarNotifications => "tooltip-sidebar-notifications",
+ _ => return None,
+ };
+ Some(crate::i18n::tr(key))
+}
+
impl UIItem {
pub fn hit_test(&self, x: isize, y: isize) -> bool {
x >= self.x as isize
@@ -1557,6 +1628,10 @@ pub struct TermWindow {
pub right_status: String,
pub left_status: String,
last_ui_item: Option<UIItem>,
+ /// The icon-only button the pointer is resting on, and when it arrived.
+ /// The tag is only painted once it has been there for TOOLTIP_DELAY, so
+ /// that sweeping the pointer across the sidebar does not strobe labels.
+ hover_tooltip: Option<HoverTooltip>,
/// Tracks whether the current mouse-down event is part of click-focus.
/// If so, we ignore mouse events until released
is_click_to_focus_window: bool,
@@ -2817,6 +2892,7 @@ impl TermWindow {
right_sidebar_open_with_app: crate::native_settings::right_sidebar_open_with_app(),
right_sidebar_input_layouts: Vec::new(),
last_ui_item: None,
+ hover_tooltip: None,
is_click_to_focus_window: false,
key_table_state: KeyTableState::default(),
modal: RefCell::new(None),
@@ -2885,7 +2961,32 @@ impl TermWindow {
}
});
- let gl = match main_renderer {
+ // Try WebGpu first when it is the selection, but never let its failure
+ // be fatal: a machine with no usable Vulkan/DX12/Metal adapter would
+ // otherwise get a window that never opens *and* no way back, because
+ // the settings window is built the same way and would fail with it.
+ // Falling back costs a log line; not falling back costs the app.
+ let mut effective_renderer = main_renderer;
+ let mut webgpu = None;
+ if matches!(
+ main_renderer,
+ crate::native_settings::NativeRendererBackend::WebGpu
+ ) {
+ gpu_debug(format!(
+ "create WebGpu main_window size={}x{} dpi={}",
+ dimensions.pixel_width, dimensions.pixel_height, dimensions.dpi
+ ));
+ match WebGpuState::new(&window, dimensions, &config).await {
+ Ok(state) => webgpu = Some(Rc::new(state)),
+ Err(err) => {
+ log::error!("WebGpu is unavailable ({err:#}); falling back to OpenGL");
+ gpu_debug(format!("WebGpu unavailable: {err:#}; falling back to OpenGL"));
+ effective_renderer = crate::native_settings::NativeRendererBackend::OpenGL;
+ }
+ }
+ }
+
+ let gl = match effective_renderer {
crate::native_settings::NativeRendererBackend::WebGpu => None,
crate::native_settings::NativeRendererBackend::OpenGL => {
gpu_debug(format!(
@@ -2898,18 +2999,6 @@ impl TermWindow {
{
let mut myself = tw.borrow_mut();
- let webgpu = match main_renderer {
- crate::native_settings::NativeRendererBackend::WebGpu => {
- gpu_debug(format!(
- "create WebGpu main_window size={}x{} dpi={}",
- dimensions.pixel_width, dimensions.pixel_height, dimensions.dpi
- ));
- Some(Rc::new(
- WebGpuState::new(&window, dimensions, &config).await?,
- ))
- }
- crate::native_settings::NativeRendererBackend::OpenGL => None,
- };
myself.config_subscription.replace(config_subscription);
if config.use_resize_increments {
window.set_resize_increments(
diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rs
index a04dd05f..c1d5f34a 100644
--- a/wezterm-gui/src/termwindow/mouseevent.rs
+++ b/wezterm-gui/src/termwindow/mouseevent.rs
@@ -1440,6 +1440,34 @@ impl super::TermWindow {
}
}
+ /// Track which icon-only button the pointer is resting on.
+ ///
+ /// Keyed by item *type*, not by the UIItem: the sidebar rebuilds its items
+ /// every frame and a button's rect can shift by a pixel, which must not
+ /// restart the delay and leave the tag forever one frame away.
+ ///
+ /// Only records when the pointer arrived. The wakeup that makes the tag
+ /// appear is registered by `paint_hover_tooltip`, because `paint_impl`
+ /// clears `has_animation` on entry and would discard a deadline set here.
+ fn update_hover_tooltip(&mut self, item: Option<&UIItem>) {
+ let labelled =
+ item.filter(|item| crate::termwindow::tooltip_label_for(&item.item_type).is_some());
+ match labelled {
+ None => self.hover_tooltip = None,
+ Some(item) => match self.hover_tooltip.as_mut() {
+ Some(hover) if hover.item.item_type == item.item_type => {
+ hover.item = item.clone();
+ }
+ _ => {
+ self.hover_tooltip = Some(crate::termwindow::HoverTooltip {
+ item: item.clone(),
+ since: Instant::now(),
+ });
+ }
+ },
+ }
+ }
+
fn enter_ui_item(&mut self, item: &UIItem) {
match item.item_type {
UIItemType::TabBar(_) => {}
@@ -2035,6 +2063,10 @@ impl super::TermWindow {
None
};
+ // Also clears while a drag holds the capture: a tag hovering next to
+ // the pointer mid-drag is noise.
+ self.update_hover_tooltip(ui_item.as_ref());
+
// A press anywhere other than the row being renamed commits a pending
// inline rename (Enter semantics); otherwise the editor stays armed
// and keeps swallowing keyboard input after the user clicked away.
diff --git a/wezterm-gui/src/termwindow/onboarding.rs b/wezterm-gui/src/termwindow/onboarding.rs
index 2908d7fb..0d64d608 100644
--- a/wezterm-gui/src/termwindow/onboarding.rs
+++ b/wezterm-gui/src/termwindow/onboarding.rs
@@ -501,6 +501,7 @@ impl OnboardingView {
+ label_h
+ tile_rows * body_h
+ body_h
+ + body_h
+ body_h;
let flex = ctx.px(MARK_SIZE
+ MARK_TO_TITLE
@@ -510,6 +511,7 @@ impl OnboardingView {
+ (rows_n - 1.0).max(0.0) * CHIP_GAP
+ tile_rows * (TILE_H + TILE_LABEL_GAP)
+ (tile_rows - 1.0).max(0.0) * TILE_GAP
+ + TILE_LABEL_GAP
+ BTN_PAD_Y * 2.0
+ SECTION_GAP * 4.0);
let fit = fit_factor(area.size.height - ctx.px(SIDE_PAD) * 2.0, rigid, flex);
@@ -520,8 +522,14 @@ impl OnboardingView {
let chips_h = rows_n * chip_h + (rows_n - 1.0).max(0.0) * fx(CHIP_GAP);
let tile_w = tile_w_base * fit;
let tile_h = fx(TILE_H);
- let modes_h = tile_rows * (tile_h + fx(TILE_LABEL_GAP) + body_h)
+ // The light-theme footnote is only drawn for Follow System and Light,
+ // but its room is reserved either way: the page is vertically centred,
+ // so letting the height depend on the selection would make everything
+ // above and below jump as the user tries the three tiles.
+ let note_h = fx(TILE_LABEL_GAP) + body_h;
+ let tiles_h = tile_rows * (tile_h + fx(TILE_LABEL_GAP) + body_h)
+ (tile_rows - 1.0).max(0.0) * fx(TILE_GAP);
+ let modes_h = tiles_h + note_h;
let brand_h = fx(MARK_SIZE) + fx(MARK_TO_TITLE) + title_h + fx(TITLE_TO_SUB) + body_h;
let group_h = |controls: f32| label_h + fx(LABEL_GAP) + controls;
let actions_h = body_h + fx(BTN_PAD_Y) * 2.0;
@@ -643,6 +651,23 @@ impl OnboardingView {
fit,
)?;
}
+
+ // --- light-theme footnote; its space is reserved in modes_h either way
+ if matches!(
+ self.selected_appearance,
+ NativeThemeMode::System | NativeThemeMode::Light
+ ) {
+ ctx.draw_text(
+ layers,
+ font,
+ col_x,
+ y + tiles_h + fx(TILE_LABEL_GAP),
+ &crate::i18n::tr("onboarding-theme-light-note"),
+ palette.muted_text,
+ col_w,
+ )?;
+ }
+
y += modes_h + gap;
// --- privacy footnote
diff --git a/wezterm-gui/src/ui/tokens.rs b/wezterm-gui/src/ui/tokens.rs
index d6b8b98d..650c495a 100644
--- a/wezterm-gui/src/ui/tokens.rs
+++ b/wezterm-gui/src/ui/tokens.rs
@@ -106,7 +106,7 @@ impl Default for UiTokens {
Self {
sidebar_min_width: 340.0,
sidebar_max_width: 580.0,
- sidebar_default_width: 380.0,
+ sidebar_default_width: 440.0,
sidebar_padding: 28.0,
row_height: 48.0,
row_gap: 8.0,