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(gui): shade the sidebars, tab bars and terminal of a see-through window

RoversX12028bfa9e9d
diff --git a/thinkterm-i18n/i18n/de-DE.ftl b/thinkterm-i18n/i18n/de-DE.ftl
index bd950737..dc557cc6 100644
--- a/thinkterm-i18n/i18n/de-DE.ftl
+++ b/thinkterm-i18n/i18n/de-DE.ftl
@@ -129,6 +129,15 @@ settings-mac-glass-blur = Unschärfe
settings-mac-glass-regular = Liquid Glass
settings-mac-glass-clear = Klares Glas
settings-mac-glass-clear-over-blur = Klar + Unschärfe
+settings-sidebar-shade = Farbe der Seitenleisten
+settings-sidebar-shade-description = Wie dunkel beide Seitenleisten sind, in einem durchscheinenden Fenster.
+settings-tab-bar-shade = Farbe der Tableisten
+settings-tab-bar-shade-description = Wie dunkel beide Tableisten sind, in einem durchscheinenden Fenster.
+settings-terminal-shade = Farbe des Terminals
+settings-terminal-shade-description = Wie dunkel der Hintergrund des Terminals ist, in einem durchscheinenden Fenster.
+settings-area-shade-dark = Dunkel
+settings-area-shade-mid = Mittel
+settings-area-shade-light = Hell
settings-badge-beta = Beta
settings-app-icon-simple = Blaue Pille
settings-app-icon-red = Rote Pille
diff --git a/thinkterm-i18n/i18n/en-US.ftl b/thinkterm-i18n/i18n/en-US.ftl
index 355c0d57..ae6a702b 100644
--- a/thinkterm-i18n/i18n/en-US.ftl
+++ b/thinkterm-i18n/i18n/en-US.ftl
@@ -129,6 +129,15 @@ settings-mac-glass-blur = Blur
settings-mac-glass-regular = Liquid Glass
settings-mac-glass-clear = Clear glass
settings-mac-glass-clear-over-blur = Clear + blur
+settings-sidebar-shade = Sidebar color
+settings-sidebar-shade-description = How dark both sidebars are, in a see-through window.
+settings-tab-bar-shade = Tab bar color
+settings-tab-bar-shade-description = How dark both tab bars are, in a see-through window.
+settings-terminal-shade = Terminal color
+settings-terminal-shade-description = How dark the terminal's background is, in a see-through window.
+settings-area-shade-dark = Dark
+settings-area-shade-mid = Mid
+settings-area-shade-light = Light
settings-badge-beta = Beta
settings-app-icon-simple = Blue Pill
settings-app-icon-red = Red Pill
diff --git a/thinkterm-i18n/i18n/fr-FR.ftl b/thinkterm-i18n/i18n/fr-FR.ftl
index b33d1db1..ea2e077a 100644
--- a/thinkterm-i18n/i18n/fr-FR.ftl
+++ b/thinkterm-i18n/i18n/fr-FR.ftl
@@ -129,6 +129,15 @@ settings-mac-glass-blur = Flou
settings-mac-glass-regular = Liquid Glass
settings-mac-glass-clear = Verre clair
settings-mac-glass-clear-over-blur = Clair + flou
+settings-sidebar-shade = Couleur des barres latérales
+settings-sidebar-shade-description = Le ton des deux barres latérales, dans une fenêtre transparente.
+settings-tab-bar-shade = Couleur des barres d'onglets
+settings-tab-bar-shade-description = Le ton des deux barres d'onglets, dans une fenêtre transparente.
+settings-terminal-shade = Couleur du terminal
+settings-terminal-shade-description = Le ton du fond du terminal, dans une fenêtre transparente.
+settings-area-shade-dark = Sombre
+settings-area-shade-mid = Moyen
+settings-area-shade-light = Clair
settings-badge-beta = Bêta
settings-app-icon-simple = Pilule bleue
settings-app-icon-red = Pilule rouge
diff --git a/thinkterm-i18n/i18n/ja-JP.ftl b/thinkterm-i18n/i18n/ja-JP.ftl
index 83343b52..37910027 100644
--- a/thinkterm-i18n/i18n/ja-JP.ftl
+++ b/thinkterm-i18n/i18n/ja-JP.ftl
@@ -126,6 +126,15 @@ settings-mac-glass-blur = ぼかし
settings-mac-glass-regular = Liquid Glass
settings-mac-glass-clear = クリアガラス
settings-mac-glass-clear-over-blur = クリア+ぼかし
+settings-sidebar-shade = サイドバーの色
+settings-sidebar-shade-description = 左右のサイドバーの濃さ。ウインドウが透けているときに効きます。
+settings-tab-bar-shade = タブバーの色
+settings-tab-bar-shade-description = 2 段のタブバーの濃さ。ウインドウが透けているときに効きます。
+settings-terminal-shade = ターミナルの色
+settings-terminal-shade-description = ターミナルの背景の濃さ。ウインドウが透けているときに効きます。
+settings-area-shade-dark = 濃い
+settings-area-shade-mid = 中間
+settings-area-shade-light = 淡い
settings-badge-beta = ベータ
settings-app-icon-simple = 青いピル
settings-app-icon-red = 赤いピル
diff --git a/thinkterm-i18n/i18n/zh-CN.ftl b/thinkterm-i18n/i18n/zh-CN.ftl
index 66f70cc4..f0c7cd4c 100644
--- a/thinkterm-i18n/i18n/zh-CN.ftl
+++ b/thinkterm-i18n/i18n/zh-CN.ftl
@@ -126,6 +126,15 @@ settings-mac-glass-blur = 模糊
settings-mac-glass-regular = 液态玻璃
settings-mac-glass-clear = 通透玻璃
settings-mac-glass-clear-over-blur = 通透+模糊
+settings-sidebar-shade = 侧栏颜色
+settings-sidebar-shade-description = 左右两个侧栏的深浅,窗口透明时生效。
+settings-tab-bar-shade = 标签栏颜色
+settings-tab-bar-shade-description = 两行标签栏的深浅,窗口透明时生效。
+settings-terminal-shade = 终端颜色
+settings-terminal-shade-description = 终端底色的深浅,窗口透明时生效。
+settings-area-shade-dark = 深
+settings-area-shade-mid = 中
+settings-area-shade-light = 浅
settings-badge-beta = Beta
settings-app-icon-simple = 蓝色药丸
settings-app-icon-red = 红色药丸
diff --git a/wezterm-gui/src/native_settings.rs b/wezterm-gui/src/native_settings.rs
index 4a3c3b98..842db2b1 100644
--- a/wezterm-gui/src/native_settings.rs
+++ b/wezterm-gui/src/native_settings.rs
@@ -424,6 +424,15 @@ pub(crate) struct NativeAppearanceSettings {
/// On macOS, what a see-through window shows behind it.
#[serde(deserialize_with = "choice_or_default")]
pub(crate) mac_glass: NativeMacGlass,
+ /// The sidebars' shade.
+ #[serde(deserialize_with = "choice_or_default")]
+ pub(crate) sidebar_shade: NativeSidebarShade,
+ /// The tab bars' shade.
+ #[serde(deserialize_with = "choice_or_default")]
+ pub(crate) tab_bar_shade: NativeShade,
+ /// The terminal's shade.
+ #[serde(deserialize_with = "choice_or_default")]
+ pub(crate) terminal_shade: NativeShade,
}
/// What a see-through window shows behind it on macOS: the plain blur, or
@@ -452,6 +461,147 @@ impl NativeMacGlass {
}
}
+/// The shade of one of the window's areas in a see-through window: dark is
+/// the sidebars' colour as designed, light the terminal's ground, mid
+/// halfway -- and as solid as `shade_opacity` says.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Deserialize, Serialize)]
+#[serde(rename_all = "snake_case")]
+pub(crate) enum NativeShade {
+ Dark,
+ Mid,
+ #[default]
+ Light,
+}
+
+impl NativeShade {
+ pub(crate) const ALL: [Self; 3] = [Self::Dark, Self::Mid, Self::Light];
+}
+
+/// `NativeShade`, for the sidebars, which are dark unless asked otherwise.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Deserialize, Serialize)]
+#[serde(rename_all = "snake_case")]
+pub(crate) enum NativeSidebarShade {
+ #[default]
+ Dark,
+ Mid,
+ Light,
+}
+
+impl NativeSidebarShade {
+ pub(crate) fn shade(self) -> NativeShade {
+ match self {
+ Self::Dark => NativeShade::Dark,
+ Self::Mid => NativeShade::Mid,
+ Self::Light => NativeShade::Light,
+ }
+ }
+
+ pub(crate) fn of(shade: NativeShade) -> Self {
+ match shade {
+ NativeShade::Dark => Self::Dark,
+ NativeShade::Mid => Self::Mid,
+ NativeShade::Light => Self::Light,
+ }
+ }
+}
+
+/// How solid an area shaded `shade` is in a window `window` opaque. In a
+/// see-through window it is the solidity, more than the colour, that makes
+/// an area look dark or light: a dark ground let through less shows darker
+/// over whatever is behind, a light one lighter. So a darker shade is more
+/// solid in a dark interface, and less in a light one. Light is the
+/// window's own opacity either way: the terminal, left light, is as solid
+/// as the slider says.
+pub(crate) fn shade_opacity(shade: NativeShade, dark_interface: bool, window: f32) -> f32 {
+ let window = window.clamp(0.0, 1.0);
+ let step = match shade {
+ NativeShade::Light => 0.0,
+ NativeShade::Mid => 0.125,
+ NativeShade::Dark => 0.25,
+ };
+ if dark_interface {
+ window + (1.0 - window) * step
+ } else {
+ window * (1.0 - step)
+ }
+}
+
+/// The shades Settings asks of a see-through window's areas.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub(crate) struct AreaShades {
+ pub(crate) sidebar: NativeShade,
+ pub(crate) tab_bar: NativeShade,
+ pub(crate) terminal: NativeShade,
+}
+
+/// `palette` with the sidebars and the tab bars shaded as Settings asks,
+/// and the terminal's ground when it is not the light one it has anyway --
+/// unless the terminal's scheme is on the other side of the interface:
+/// the interface's greys under that scheme's text would not be read.
+pub(crate) fn apply_area_shades(
+ settings: &ThinkTermNativeSettings,
+ mut palette: crate::ui::UiPalette,
+ scheme_on_interface_side: bool,
+) -> (crate::ui::UiPalette, Option<window::color::LinearRgba>) {
+ let dark = palette.workspace_sidebar_bg;
+ let light = palette.header_bg;
+ let (dr, dg, db, da) = dark.tuple();
+ let (lr, lg, lb, la) = light.tuple();
+ let mid = window::color::LinearRgba::with_components(
+ (dr + lr) / 2.0,
+ (dg + lg) / 2.0,
+ (db + lb) / 2.0,
+ (da + la) / 2.0,
+ );
+ let pick = |shade: NativeShade| match shade {
+ NativeShade::Dark => dark,
+ NativeShade::Mid => mid,
+ NativeShade::Light => light,
+ };
+ let appearance = &settings.appearance;
+ palette.workspace_sidebar_bg = pick(appearance.sidebar_shade.shade());
+ palette.header_bg = pick(appearance.tab_bar_shade);
+ let terminal = (appearance.terminal_shade != NativeShade::Light && scheme_on_interface_side)
+ .then(|| pick(appearance.terminal_shade));
+ (palette, terminal)
+}
+
+/// How solid the chrome around the terminal is in a window `window` opaque:
+/// a step more than the terminal, so that it still reads as its frame.
+pub(crate) fn frame_opacity(window: f32) -> f32 {
+ let window = window.clamp(0.0, 1.0);
+ window + (1.0 - window) / 4.0
+}
+
+/// The chrome palette a terminal window paints with: `chrome_palette`, its
+/// areas coloured as Settings says.
+pub(crate) fn window_chrome_palette(
+ appearance: Appearance,
+ config: &config::ConfigHandle,
+ preview_ground: Option<window::color::LinearRgba>,
+) -> (crate::ui::UiPalette, Option<window::color::LinearRgba>, Option<AreaShades>) {
+ let settings = load_shared();
+ let palette = chrome_palette(settings.appearance.theme_mode, appearance, config, preview_ground);
+ // The shades are for a see-through window: an opaque one keeps its
+ // areas as designed.
+ if config.window_background_opacity >= 1.0 {
+ return (palette, None, None);
+ }
+ let ground = preview_ground.unwrap_or_else(|| terminal_ground(config));
+ let dark = |appearance: Appearance| {
+ matches!(appearance, Appearance::Dark | Appearance::DarkHighContrast)
+ };
+ let scheme_on_interface_side =
+ dark(crate::ui::UiPalette::appearance_of(ground)) == dark(appearance);
+ let (palette, terminal) = apply_area_shades(&settings, palette, scheme_on_interface_side);
+ let shades = AreaShades {
+ sidebar: settings.appearance.sidebar_shade.shade(),
+ tab_bar: settings.appearance.tab_bar_shade,
+ terminal: settings.appearance.terminal_shade,
+ };
+ (palette, terminal, Some(shades))
+}
+
/// The window opacity, whatever shape a hand edit gave it. One field that
/// fails to parse loses the whole file to the defaults, and the next save
/// writes them over everything, so: a fraction such as 0.8 is read as 80, a
@@ -1983,6 +2133,9 @@ fn apply_external_change(before: &ThinkTermNativeSettings, after: &ThinkTermNati
|| before.appearance.color_scheme != after.appearance.color_scheme
|| before.appearance.window_opacity != after.appearance.window_opacity
|| before.appearance.mac_glass != after.appearance.mac_glass
+ || before.appearance.sidebar_shade != after.appearance.sidebar_shade
+ || before.appearance.tab_bar_shade != after.appearance.tab_bar_shade
+ || before.appearance.terminal_shade != after.appearance.terminal_shade
{
// Language, theme, colour scheme, opacity, chrome and app icon.
apply_to_app(after);
@@ -3011,6 +3164,44 @@ mod tests {
assert_eq!(read(r#""something_new""#), NativeMacGlass::Blur);
}
+ #[test]
+ fn each_area_takes_the_shade_asked_for() {
+ let palette = crate::ui::UiPalette::for_appearance(Appearance::Dark);
+ let (dark, light) = (palette.workspace_sidebar_bg, palette.header_bg);
+ let mut settings = ThinkTermNativeSettings::default();
+ // As designed unless asked otherwise.
+ assert_eq!(apply_area_shades(&settings, palette, true), (palette, None));
+ settings.appearance.sidebar_shade = NativeSidebarShade::Light;
+ settings.appearance.tab_bar_shade = NativeShade::Dark;
+ settings.appearance.terminal_shade = NativeShade::Mid;
+ let (shaded, terminal) = apply_area_shades(&settings, palette, true);
+ assert_eq!(shaded.workspace_sidebar_bg, light);
+ assert_eq!(shaded.header_bg, dark);
+ let mid = terminal.expect("a mid terminal is asked for");
+ assert!(mid != dark && mid != light);
+ // The terminal's own ground is left to its override, not the
+ // palette's sidebar colour, and none on the scheme's other side.
+ assert_eq!(shaded.sidebar_bg, palette.sidebar_bg);
+ assert_eq!(apply_area_shades(&settings, palette, false).1, None);
+ // Light is the window's own opacity in either interface.
+ assert_eq!(shade_opacity(NativeShade::Light, false, 0.3), 0.3);
+ assert_eq!(shade_opacity(NativeShade::Light, false, 0.0), 0.0);
+ // Darker is more solid in a dark interface, less in a light one;
+ // opaque stays opaque.
+ assert!(shade_opacity(NativeShade::Dark, true, 0.3) > shade_opacity(NativeShade::Mid, true, 0.3));
+ assert!(shade_opacity(NativeShade::Mid, true, 0.3) > shade_opacity(NativeShade::Light, true, 0.3));
+ assert_eq!(shade_opacity(NativeShade::Light, true, 0.3), 0.3);
+ assert!(shade_opacity(NativeShade::Dark, false, 0.3) < shade_opacity(NativeShade::Light, false, 0.3));
+ for shade in NativeShade::ALL {
+ assert_eq!(shade_opacity(shade, true, 1.0), 1.0);
+ }
+ let text = r#"{"appearance":{"sidebar_shade":"something_new","terminal_shade":"dark"}}"#;
+ let settings: ThinkTermNativeSettings = serde_json::from_str(text).unwrap();
+ assert_eq!(settings.appearance.sidebar_shade, NativeSidebarShade::Dark);
+ assert_eq!(settings.appearance.tab_bar_shade, NativeShade::Light);
+ assert_eq!(settings.appearance.terminal_shade, NativeShade::Dark);
+ }
+
#[test]
fn a_frosted_glass_choice_left_by_a_trial_build_is_ignored() {
let text = r#"{"appearance":{"window_opacity":80,"windows_backdrop":"composition"}}"#;
diff --git a/wezterm-gui/src/settings_window.rs b/wezterm-gui/src/settings_window.rs
index 77936329..3a57bdad 100644
--- a/wezterm-gui/src/settings_window.rs
+++ b/wezterm-gui/src/settings_window.rs
@@ -1527,6 +1527,15 @@ fn localized_mac_glass_label(glass: crate::native_settings::NativeMacGlass) -> S
})
}
+fn localized_shade_label(shade: crate::native_settings::NativeShade) -> String {
+ use crate::native_settings::NativeShade;
+ crate::i18n::tr(match shade {
+ NativeShade::Dark => "settings-area-shade-dark",
+ NativeShade::Mid => "settings-area-shade-mid",
+ NativeShade::Light => "settings-area-shade-light",
+ })
+}
+
/// Whether this macOS has Liquid Glass to offer.
fn liquid_glass_available() -> bool {
#[cfg(target_os = "macos")]
@@ -1858,6 +1867,9 @@ enum SettingsAction {
SetMainRenderer(NativeRendererBackend),
ToggleMacGlassMenu,
SetMacGlass(crate::native_settings::NativeMacGlass),
+ SetSidebarShade(crate::native_settings::NativeShade),
+ SetTabBarShade(crate::native_settings::NativeShade),
+ SetTerminalShade(crate::native_settings::NativeShade),
ToggleDownloadSourceMenu,
SetDownloadSource(thinkterm_update::DownloadSource),
/// Swallows clicks that land in an open dropdown's padding or row
@@ -6081,6 +6093,23 @@ impl SettingsWindow {
};
}
SettingsAction::SetMacGlass(glass) => self.apply_mac_glass(glass),
+ SettingsAction::SetSidebarShade(shade) => self.apply_window_areas(
+ "settings-sidebar-shade",
+ localized_shade_label(shade),
+ |appearance| {
+ appearance.sidebar_shade = crate::native_settings::NativeSidebarShade::of(shade)
+ },
+ ),
+ SettingsAction::SetTabBarShade(shade) => self.apply_window_areas(
+ "settings-tab-bar-shade",
+ localized_shade_label(shade),
+ |appearance| appearance.tab_bar_shade = shade,
+ ),
+ SettingsAction::SetTerminalShade(shade) => self.apply_window_areas(
+ "settings-terminal-shade",
+ localized_shade_label(shade),
+ |appearance| appearance.terminal_shade = shade,
+ ),
SettingsAction::ToggleMainRendererMenu => {
self.ui.open_dropdown =
if self.ui.open_dropdown == Some(SettingsDropdown::MainRenderer) {
@@ -8610,6 +8639,56 @@ impl SettingsWindow {
current,
)?);
}
+ // Only where Settings can make the window see-through.
+ if crate::native_settings::window_opacity_supported() {
+ let appearance = &this.native_settings.appearance;
+ let shades = [
+ (
+ "settings-sidebar-shade",
+ appearance.sidebar_shade.shade(),
+ SettingsAction::SetSidebarShade as fn(_) -> SettingsAction,
+ ),
+ (
+ "settings-tab-bar-shade",
+ appearance.tab_bar_shade,
+ SettingsAction::SetTabBarShade as fn(_) -> SettingsAction,
+ ),
+ (
+ "settings-terminal-shade",
+ appearance.terminal_shade,
+ SettingsAction::SetTerminalShade as fn(_) -> SettingsAction,
+ ),
+ ];
+ for (title, current, action) in shades {
+ let options: Vec<(String, SettingsAction)> = crate::native_settings::NativeShade::ALL
+ .iter()
+ .map(|shade| (localized_shade_label(*shade), action(*shade)))
+ .collect();
+ let selected = crate::native_settings::NativeShade::ALL
+ .iter()
+ .position(|shade| *shade == current)
+ .unwrap_or(0);
+ let (tx, tw) = this.paint_row_tile(
+ layers,
+ row_x,
+ rows.y,
+ row_width,
+ SvgIcon::Contrast,
+ TileColor::Teal,
+ )?;
+ rows.add(this.paint_segmented_setting_row(
+ layers,
+ tx,
+ rows.y,
+ tw,
+ &crate::i18n::tr(title),
+ &crate::i18n::tr(&format!("{title}-description")),
+ &options,
+ selected,
+ rows.rule(),
+ )?);
+ }
+ }
Ok(rows.bottom)
})?;
@@ -18100,6 +18179,38 @@ impl SettingsWindow {
.collect()
}
+ /// How the window's areas are coloured, in every window at once:
+ /// `change` makes it, `value` names it.
+ fn apply_window_areas(
+ &mut self,
+ setting_key: &str,
+ value: String,
+ change: impl FnOnce(&mut crate::native_settings::NativeAppearanceSettings),
+ ) {
+ self.ui.open_dropdown = None;
+ // Merged into the freshest settings, as `apply_window_opacity` is.
+ let mut merged = crate::native_settings::load();
+ change(&mut merged.appearance);
+ self.set_native_settings(merged);
+ let setting = crate::i18n::tr(setting_key);
+ match crate::native_settings::save(&self.native_settings) {
+ Ok(()) => {
+ crate::native_settings::apply_to_app(&self.native_settings);
+ self.status = settings_tr(
+ "settings-status-value-now",
+ &[("setting", setting), ("value", value)],
+ );
+ }
+ Err(err) => {
+ self.set_native_settings(crate::native_settings::load());
+ self.status = settings_tr(
+ "settings-status-save-error",
+ &[("setting", setting), ("error", format!("{err:#}"))],
+ );
+ }
+ }
+ }
+
/// What a see-through window shows behind it on macOS, in every window
/// at once, as the window opacity is.
fn apply_mac_glass(&mut self, glass: crate::native_settings::NativeMacGlass) {
diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs
index 370fd39f..cd85e6e6 100644
--- a/wezterm-gui/src/termwindow/mod.rs
+++ b/wezterm-gui/src/termwindow/mod.rs
@@ -2313,17 +2313,13 @@ fn settings_override_changes(
applied
}
-fn chrome_opacity(window_opacity: f32) -> f32 {
- let window = window_opacity.clamp(0.0, 1.0);
- window + (1.0 - window) / 4.0
-}
-
#[cfg(test)]
mod chrome_opacity_tests {
- use super::chrome_opacity;
+ use crate::native_settings::frame_opacity;
#[test]
fn chrome_is_a_step_more_solid_than_the_terminal() {
+ let chrome_opacity = frame_opacity;
assert_eq!(chrome_opacity(1.0), 1.0);
assert!((chrome_opacity(0.8) - 0.85).abs() < 1e-6);
assert_eq!(chrome_opacity(0.0), 0.25);
@@ -3021,6 +3017,12 @@ pub struct TermWindow {
/// Refreshed in `config_was_reloaded`, which is also where a colour scheme
/// override and an appearance change both land.
chrome_palette: crate::ui::UiPalette,
+ /// The terminal's ground when Settings shades it other than its own,
+ /// read with `chrome_palette`.
+ terminal_shade: Option<LinearRgba>,
+ /// The shades Settings asks of the areas of a see-through window, read
+ /// with `chrome_palette`; `None` when opaque.
+ area_shades: Option<crate::native_settings::AreaShades>,
/// The interface appearance `chrome_palette` was resolved for. A palette
/// following the terminal takes its own from the scheme instead, so the
/// two can differ.
@@ -4674,6 +4676,12 @@ impl TermWindow {
let active_space_has_note_vault =
crate::workspace_threads::space_note_vault(&active_space_id).is_some();
+ let (chrome_palette, terminal_shade, area_shades) =
+ crate::native_settings::window_chrome_palette(
+ crate::native_settings::effective_appearance(),
+ &config,
+ None,
+ );
let myself = Self {
frontend_geometry_phases: HashMap::new(),
remote_open_intent: remote_open_domain
@@ -4783,12 +4791,9 @@ impl TermWindow {
last_mouse_click: None,
current_highlight: None,
quad_generation: 0,
- chrome_palette: crate::native_settings::chrome_palette(
- crate::native_settings::load_shared().appearance.theme_mode,
- crate::native_settings::effective_appearance(),
- &config,
- None,
- ),
+ chrome_palette,
+ terminal_shade,
+ area_shades,
chrome_appearance: crate::native_settings::effective_appearance(),
shape_generation: 0,
shape_cache: RefCell::new(LfuCache::new_weighted(
@@ -7564,8 +7569,8 @@ impl TermWindow {
/// configuration reload behind it.
pub(crate) fn refresh_chrome(&mut self) {
self.chrome_appearance = crate::native_settings::effective_appearance();
- self.chrome_palette = crate::native_settings::chrome_palette(
- crate::native_settings::load_shared().appearance.theme_mode,
+ (self.chrome_palette, self.terminal_shade, self.area_shades) =
+ crate::native_settings::window_chrome_palette(
self.chrome_appearance,
&self.config,
self.scheme_preview_ground,
@@ -7797,8 +7802,8 @@ impl TermWindow {
// these two -- the settings-window routes reach them only through
// their own notifies.
self.chrome_appearance = crate::native_settings::effective_appearance();
- self.chrome_palette = crate::native_settings::chrome_palette(
- crate::native_settings::load_shared().appearance.theme_mode,
+ (self.chrome_palette, self.terminal_shade, self.area_shades) =
+ crate::native_settings::window_chrome_palette(
self.chrome_appearance,
&config,
self.scheme_preview_ground,
@@ -8882,16 +8887,20 @@ impl TermWindow {
theme_aligned_tab_bar_colors_from_palette(&self.palette().clone(), background)
}
- /// The terminal's ground in a dark interface: the chrome's colour rather
- /// than the scheme's background. `None` in a light one, where the scheme's
+ /// The terminal's ground when it is not the scheme's background: the
+ /// shade Settings asks of it in a see-through window, else in a dark
+ /// interface the chrome's colour. `None` otherwise, where the scheme's
/// background shows. Read off the appearance cached with the chrome
/// palette; asking for it anew is costly (see `chrome_palette`).
pub(crate) fn dark_terminal_ground(&self) -> Option<LinearRgba> {
- matches!(
- self.chrome_appearance,
- ::window::Appearance::Dark | ::window::Appearance::DarkHighContrast
- )
- .then(|| self.chrome().sidebar_bg)
+ // A shade asked for in Settings, in either interface.
+ self.terminal_shade.or_else(|| {
+ matches!(
+ self.chrome_appearance,
+ ::window::Appearance::Dark | ::window::Appearance::DarkHighContrast
+ )
+ .then(|| self.chrome().sidebar_bg)
+ })
}
/// `color` as a surface of the chrome paints it. In a see-through window
@@ -8899,7 +8908,65 @@ impl TermWindow {
/// through as well, but less than the terminal does, so that they still
/// read as the frame around it.
pub(crate) fn chrome_surface(&self, color: LinearRgba) -> LinearRgba {
- color.mul_alpha(chrome_opacity(self.chrome_window_opacity()))
+ color.mul_alpha(crate::native_settings::frame_opacity(self.chrome_window_opacity()))
+ }
+
+ /// `color` as a sidebar paints it: as the chrome does, or as solid as
+ /// the shade Settings asks of it.
+ pub(crate) fn sidebar_surface(&self, color: LinearRgba) -> LinearRgba {
+ self.area_surface(color, self.area_shades.map(|shades| shades.sidebar))
+ }
+
+ /// `color` as a tab bar paints it: as the chrome does, or as solid as
+ /// the shade Settings asks of it.
+ pub(crate) fn tab_bar_surface(&self, color: LinearRgba) -> LinearRgba {
+ self.area_surface(color, self.area_shades.map(|shades| shades.tab_bar))
+ }
+
+ /// A collapsed pane stack's bar: the pane nav bars' fellow, so shaded as
+ /// the tab bars are in a see-through window, and as it always was in an
+ /// opaque one.
+ pub(crate) fn collapsed_bar_surface(&self) -> LinearRgba {
+ if self.area_shades.is_some() {
+ self.tab_bar_surface(self.chrome().header_bg)
+ } else {
+ self.chrome_surface(self.chrome().sidebar_bg)
+ }
+ }
+
+ fn area_surface(
+ &self,
+ color: LinearRgba,
+ shade: Option<crate::native_settings::NativeShade>,
+ ) -> LinearRgba {
+ match shade {
+ Some(shade) => color.mul_alpha(crate::native_settings::shade_opacity(
+ shade,
+ self.dark_interface(),
+ self.chrome_window_opacity(),
+ )),
+ None => self.chrome_surface(color),
+ }
+ }
+
+ /// How solid the terminal's ground is in a window `window` opaque: as
+ /// solid as the shade Settings asks of it, in a see-through window.
+ pub(crate) fn terminal_ground_opacity(&self, window: f32) -> f32 {
+ match self.area_shades {
+ Some(shades) => crate::native_settings::shade_opacity(
+ shades.terminal,
+ self.dark_interface(),
+ window,
+ ),
+ None => window,
+ }
+ }
+
+ fn dark_interface(&self) -> bool {
+ matches!(
+ self.chrome_appearance,
+ ::window::Appearance::Dark | ::window::Appearance::DarkHighContrast
+ )
}
/// Whether the window is see-through, and its chrome with it. Covering
@@ -8989,7 +9056,20 @@ impl TermWindow {
if (config.window_background_opacity != 1.0) != (before.window_background_opacity != 1.0) {
self.quad_generation += 1;
}
+ let crossed_opaque = (config.window_background_opacity >= 1.0)
+ != (before.window_background_opacity >= 1.0);
self.config = config;
+ // The area shades are for a see-through window: going opaque or
+ // see-through -- the slider dragged across 100%, full screen -- takes
+ // them away or brings them back without a reload.
+ if crossed_opaque {
+ (self.chrome_palette, self.terminal_shade, self.area_shades) =
+ crate::native_settings::window_chrome_palette(
+ self.chrome_appearance,
+ &self.config,
+ self.scheme_preview_ground,
+ );
+ }
self.invalidate_fancy_tab_bar();
if let Some(window) = self.window.as_ref() {
if platform_changed {
diff --git a/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs b/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs
index 5c03186d..547716e3 100644
--- a/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs
+++ b/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs
@@ -55,7 +55,7 @@ impl crate::TermWindow {
let metrics = RenderMetrics::with_font_metrics(&font.metrics());
let tab_width = self.window_tab_width_pixels().ceil() as usize;
- let background = self.chrome_surface(chrome.header_bg);
+ let background = self.tab_bar_surface(chrome.header_bg);
let foreground = chrome.text;
let muted_fg = chrome.secondary_text;
diff --git a/wezterm-gui/src/termwindow/render/paint.rs b/wezterm-gui/src/termwindow/render/paint.rs
index c6d39b3a..9fa1aeb7 100644
--- a/wezterm-gui/src/termwindow/render/paint.rs
+++ b/wezterm-gui/src/termwindow/render/paint.rs
@@ -2027,7 +2027,7 @@ impl crate::TermWindow {
} else {
self.palette().background.to_linear()
};
- ground.mul_alpha(self.config.window_background_opacity)
+ ground.mul_alpha(self.terminal_ground_opacity(self.config.window_background_opacity))
}
/// Record the window frame in three pieces, one per edge it can leave by.
diff --git a/wezterm-gui/src/termwindow/render/pane.rs b/wezterm-gui/src/termwindow/render/pane.rs
index 157f6ad6..e546f8ea 100644
--- a/wezterm-gui/src/termwindow/render/pane.rs
+++ b/wezterm-gui/src/termwindow/render/pane.rs
@@ -467,7 +467,7 @@ impl crate::TermWindow {
rect,
self.dark_terminal_ground()
.unwrap_or_else(|| palette.background.to_linear())
- .mul_alpha(self.config.window_background_opacity),
+ .mul_alpha(self.terminal_ground_opacity(self.config.window_background_opacity)),
)?;
quad.set_hsv(if pos.is_active {
None
@@ -514,7 +514,7 @@ impl crate::TermWindow {
);
self.paint_ground_of(layers, pos, above)?;
self.paint_ground_of(layers, pos, below)?;
- self.filled_rectangle(layers, 0, band, self.chrome_surface(self.chrome().header_bg))
+ self.filled_rectangle(layers, 0, band, self.tab_bar_surface(self.chrome().header_bg))
.context("pane nav band")?;
Ok(())
}
@@ -565,7 +565,7 @@ impl crate::TermWindow {
let foreground = chrome.text;
let muted_fg = chrome.secondary_text;
- self.filled_rectangle(layers, 0, pane_rect, self.chrome_surface(chrome.sidebar_bg))
+ self.filled_rectangle(layers, 0, pane_rect, self.collapsed_bar_surface())
.context("collapsed pane background")?;
self.ui_items.push(UIItem {
@@ -953,7 +953,7 @@ impl crate::TermWindow {
// sliced in half.
self.paint_tab_row_fades(
layers,
- self.chrome_surface(chrome.sidebar_bg),
+ self.collapsed_bar_surface(),
tab_y,
tab_height,
tab_start,
@@ -1046,7 +1046,7 @@ impl crate::TermWindow {
// the tab strip itself. `header_bg` is the chrome's own colour in a
// dark interface, so nothing moves there.
// Over nothing see-through: the pane's ground stops below it.
- let background = self.chrome_surface(chrome.header_bg);
+ let background = self.tab_bar_surface(chrome.header_bg);
let foreground = chrome.text;
let muted_fg = chrome.secondary_text;
let tab_fg = if pos.is_active { foreground } else { muted_fg };
@@ -2011,7 +2011,7 @@ impl crate::TermWindow {
*background_rect,
dark_chrome_background
.unwrap_or_else(|| palette.background.to_linear())
- .mul_alpha(config.window_background_opacity),
+ .mul_alpha(self.terminal_ground_opacity(config.window_background_opacity)),
)
.context("filled_rectangle")?;
quad.set_hsv(if pos.is_active {
diff --git a/wezterm-gui/src/termwindow/render/tab_bar.rs b/wezterm-gui/src/termwindow/render/tab_bar.rs
index 424c221a..a5f19bbd 100644
--- a/wezterm-gui/src/termwindow/render/tab_bar.rs
+++ b/wezterm-gui/src/termwindow/render/tab_bar.rs
@@ -158,7 +158,7 @@ impl crate::TermWindow {
Some(colors) => colors.background().to_linear(),
None => terminal_bg,
}
- .mul_alpha(self.config.window_background_opacity);
+ .mul_alpha(self.terminal_ground_opacity(self.config.window_background_opacity));
let gl_state = self.render_state.as_ref().unwrap();
let white_space = gl_state.util_sprites.white_space.texture_coords();
let filled_box = gl_state.util_sprites.filled_box.texture_coords();
diff --git a/wezterm-gui/src/termwindow/ui/right_sidebar.rs b/wezterm-gui/src/termwindow/ui/right_sidebar.rs
index 76304a10..50745681 100644
--- a/wezterm-gui/src/termwindow/ui/right_sidebar.rs
+++ b/wezterm-gui/src/termwindow/ui/right_sidebar.rs
@@ -9108,7 +9108,7 @@ impl crate::TermWindow {
let chrome = self.chrome();
let foreground = chrome.text;
let muted_fg = chrome.secondary_text;
- let sidebar_bg = self.chrome_surface(chrome.workspace_sidebar_bg);
+ let sidebar_bg = self.sidebar_surface(chrome.workspace_sidebar_bg);
let see_through = self.chrome_see_through();
let settings = crate::native_settings::load();
let base_font_size = crate::native_settings::right_sidebar_font_size(&settings);
@@ -13336,7 +13336,7 @@ impl crate::TermWindow {
muted_fg: LinearRgba,
rect: RightSidebarRect,
) -> anyhow::Result<()> {
- let sidebar_bg = self.chrome_surface(chrome.workspace_sidebar_bg);
+ let sidebar_bg = self.sidebar_surface(chrome.workspace_sidebar_bg);
// See-through, the band above is the window border's alone.
if rect.y > 0 && !self.chrome_see_through() {
self.filled_rectangle(
@@ -18635,7 +18635,7 @@ impl crate::TermWindow {
layers,
2,
euclid::rect(x as f32, y as f32, width as f32, height as f32),
- self.chrome_surface(chrome.workspace_sidebar_bg),
+ self.sidebar_surface(chrome.workspace_sidebar_bg),
)
.context("right sidebar file scroll mask")?;
Ok(())
@@ -18693,7 +18693,7 @@ impl crate::TermWindow {
layers,
2,
euclid::rect(x as f32, (y + step) as f32, width as f32, 1.0),
- self.chrome_surface(chrome.workspace_sidebar_bg)
+ self.sidebar_surface(chrome.workspace_sidebar_bg)
.mul_alpha(alpha),
)
.context("right sidebar file top fade")?;
diff --git a/wezterm-gui/src/termwindow/ui/sidebar.rs b/wezterm-gui/src/termwindow/ui/sidebar.rs
index 4f9ae43d..3f032316 100644
--- a/wezterm-gui/src/termwindow/ui/sidebar.rs
+++ b/wezterm-gui/src/termwindow/ui/sidebar.rs
@@ -1145,7 +1145,7 @@ impl crate::TermWindow {
let chrome = self.chrome();
let foreground = chrome.text;
- let sidebar_bg = self.chrome_surface(chrome.workspace_sidebar_bg);
+ let sidebar_bg = self.sidebar_surface(chrome.workspace_sidebar_bg);
let see_through = self.chrome_see_through();
let sidebar_separator = chrome.separator;
let selected_bg = chrome.sidebar_row_active_bg;
@@ -3304,7 +3304,7 @@ impl crate::TermWindow {
ring,
ring,
),
- self.chrome_surface(chrome.workspace_sidebar_bg),
+ self.sidebar_surface(chrome.workspace_sidebar_bg),
ring / 2.0,
)
.context("sidebar update dot ring")?;
diff --git a/wezterm-gui/src/ui/tokens.rs b/wezterm-gui/src/ui/tokens.rs
index 385a936f..95288eca 100644
--- a/wezterm-gui/src/ui/tokens.rs
+++ b/wezterm-gui/src/ui/tokens.rs
@@ -268,7 +268,9 @@ impl UiPalette {
/// tabs are the same control drawn twice, and they looked it until one of
/// them was changed alone.
pub(crate) fn active_tab_surface(&self) -> LinearRgba {
- if self.header_bg == self.sidebar_bg {
+ // A dark interface keeps the raised control however its tab bars
+ // are shaded.
+ if self.header_bg == self.sidebar_bg || self.is_dark() {
self.control_bg
} else {
self.sidebar_bg