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
Add alternate app icon, pane collapse, and diagnostics
RoversX4f12880faa40
diff --git a/.gitignore b/.gitignoreindex 1080df2d..78b962b8 100644--- a/.gitignore+++ b/.gitignore@@ -68,3 +68,4 @@ dhat-heap.json/nix/result/research/docs/+ThinkTerm-macos-v0.1.0.zipdiff --git a/assets/icon/ThinkTerm.icon/Assets/Vector.png b/assets/icon/ThinkTerm.icon/Assets/Vector.pngnew file mode 100644index 00000000..cb898cf2Binary files /dev/null and b/assets/icon/ThinkTerm.icon/Assets/Vector.png differdiff --git a/assets/icon/ThinkTerm.icon/Assets/image 2.png b/assets/icon/ThinkTerm.icon/Assets/image 2.pngnew file mode 100644index 00000000..19b5527eBinary files /dev/null and b/assets/icon/ThinkTerm.icon/Assets/image 2.png differdiff --git a/assets/icon/ThinkTerm.icon/icon.json b/assets/icon/ThinkTerm.icon/icon.jsonnew file mode 100644index 00000000..ceb541d7--- /dev/null+++ b/assets/icon/ThinkTerm.icon/icon.json@@ -0,0 +1,75 @@+{+ "fill" : "system-dark",+ "groups" : [+ {+ "layers" : [+ {+ "fill" : {+ "linear-gradient" : [+ "extended-gray:1.00000,1.00000",+ "extended-gray:1.00000,1.00000"+ ],+ "orientation" : {+ "start" : {+ "x" : 0.5,+ "y" : 0+ },+ "stop" : {+ "x" : 0.35579199446386944,+ "y" : 0.8626027647282886+ }+ }+ },+ "glass" : true,+ "image-name" : "Vector.png",+ "name" : "Vector",+ "position" : {+ "scale" : 0.66,+ "translation-in-points" : [+ 0,+ 0+ ]+ }+ }+ ],+ "shadow" : {+ "kind" : "neutral",+ "opacity" : 0.5+ },+ "translucency" : {+ "enabled" : true,+ "value" : 0.5+ }+ },+ {+ "layers" : [+ {+ "glass" : false,+ "image-name" : "image 2.png",+ "name" : "image 2",+ "position" : {+ "scale" : 1,+ "translation-in-points" : [+ 0,+ 0+ ]+ }+ }+ ],+ "shadow" : {+ "kind" : "neutral",+ "opacity" : 0.5+ },+ "translucency" : {+ "enabled" : true,+ "value" : 0.5+ }+ }+ ],+ "supported-platforms" : {+ "circles" : [+ "watchOS"+ ],+ "squares" : "shared"+ }+}\ No newline at end of filediff --git a/assets/icon/ThinkTerm_simple.icns b/assets/icon/ThinkTerm_simple.icnsnew file mode 100644index 00000000..c38b7ba3Binary files /dev/null and b/assets/icon/ThinkTerm_simple.icns differdiff --git a/assets/icon/ThinkTerm_simple.png b/assets/icon/ThinkTerm_simple.pngnew file mode 100644index 00000000..19102042Binary files /dev/null and b/assets/icon/ThinkTerm_simple.png differdiff --git a/ci/deploy.sh b/ci/deploy.shindex 7b8f2326..4803d364 100755--- a/ci/deploy.sh+++ b/ci/deploy.sh@@ -33,6 +33,7 @@ case $OSTYPE inrm $zipdir/ThinkTerm.app/*.dylibmkdir -p $zipdir/ThinkTerm.app/Contents/MacOSmkdir -p $zipdir/ThinkTerm.app/Contents/Resources+ cp assets/icon/ThinkTerm_simple.icns $zipdir/ThinkTerm.app/Contents/Resources/ThinkTerm_simple.icnscp -r assets/shell-integration/* $zipdir/ThinkTerm.app/Contents/Resourcescp -r assets/shell-completion $zipdir/ThinkTerm.app/Contents/Resourcestic -xe wezterm -o $zipdir/ThinkTerm.app/Contents/Resources/terminfo termwiz/data/wezterm.terminfodiff --git a/mux/src/tab.rs b/mux/src/tab.rsindex ed9e2d55..0294f8ad 100644--- a/mux/src/tab.rs+++ b/mux/src/tab.rs@@ -220,6 +220,14 @@ pub struct PositionedPane {pub pane: Arc<dyn Pane>,}+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub struct CollapsedPaneLayout {+ pub pane_stack_id: PaneStackId,+ pub split_direction: SplitDirection,+ pub active_is_second: bool,+ pub active_cells_before: usize,+}+impl std::fmt::Debug for PositionedPane {fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {fmt.debug_struct("PositionedPane")@@ -778,6 +786,10 @@ impl Tab {self.inner.lock().pane_stack_id(pane_id)}+ pub fn pane_split_direction_by_index(&self, pane_index: usize) -> Option<SplitDirection> {+ self.inner.lock().pane_split_direction_by_index(pane_index)+ }+pub fn pane_index_for_pane(&self, pane_id: PaneId) -> Option<usize> {self.inner.lock().pane_index_for_pane(pane_id)}@@ -841,6 +853,24 @@ impl Tab {self.inner.lock().resize_split_by(split_index, delta)}+ pub fn collapse_pane_by_index(+ &self,+ pane_index: usize,+ min_cells: usize,+ ) -> Option<CollapsedPaneLayout> {+ self.inner+ .lock()+ .collapse_pane_by_index(pane_index, min_cells)+ }++ pub fn restore_collapsed_pane(&self, layout: CollapsedPaneLayout) -> bool {+ self.inner.lock().restore_collapsed_pane(layout)+ }++ pub fn reapply_collapsed_pane(&self, layout: CollapsedPaneLayout, min_cells: usize) -> bool {+ self.inner.lock().reapply_collapsed_pane(layout, min_cells)+ }+/// Adjusts the size of the active pane in the specified direction/// by the specified amount.pub fn adjust_pane_size(&self, direction: PaneDirection, amount: usize) {@@ -1225,6 +1255,40 @@ impl TabInner {pane_stack_id}+ fn pane_split_direction_by_index(&mut self, pane_index: usize) -> Option<SplitDirection> {+ if self.zoomed.is_some() {+ return None;+ }++ let mut cursor = self.pane.take()?.cursor();+ let mut index = 0;++ loop {+ if cursor.is_leaf() {+ if index == pane_index {+ break;+ }+ index += 1;+ }++ match cursor.preorder_next() {+ Ok(c) => cursor = c,+ Err(c) => {+ self.pane.replace(c.tree());+ return None;+ }+ }+ }++ let direction = {+ let mut path = cursor.path_to_root();+ path.next()+ .and_then(|(_, parent)| parent.map(|node| node.direction))+ };+ self.pane.replace(cursor.tree());+ direction+ }+fn pane_index_for_pane(&mut self, pane_id: PaneId) -> Option<usize> {let mut cursor = self.pane.take().unwrap().cursor();let mut pane_index = 0;@@ -1674,6 +1738,245 @@ impl TabInner {}}+ fn split_branch_cells(node: &SplitDirectionAndSize, active_is_second: bool) -> usize {+ match (node.direction, active_is_second) {+ (SplitDirection::Horizontal, false) => node.first.cols,+ (SplitDirection::Horizontal, true) => node.second.cols,+ (SplitDirection::Vertical, false) => node.first.rows,+ (SplitDirection::Vertical, true) => node.second.rows,+ }+ }++ fn set_split_branch_cells(+ node: &mut SplitDirectionAndSize,+ active_is_second: bool,+ active_cells: usize,+ cell_dimensions: TerminalSize,+ ) {+ let total = match node.direction {+ SplitDirection::Horizontal => node.width(),+ SplitDirection::Vertical => node.height(),+ };+ if total < 3 {+ return;+ }++ let active_cells = active_cells.max(1).min(total.saturating_sub(2));+ let other_cells = total.saturating_sub(active_cells.saturating_add(1)).max(1);++ match (node.direction, active_is_second) {+ (SplitDirection::Horizontal, false) => {+ node.first.cols = active_cells;+ node.second.cols = other_cells;+ node.first.pixel_width = active_cells.saturating_mul(cell_dimensions.pixel_width);+ node.second.pixel_width = other_cells.saturating_mul(cell_dimensions.pixel_width);+ }+ (SplitDirection::Horizontal, true) => {+ node.first.cols = other_cells;+ node.second.cols = active_cells;+ node.first.pixel_width = other_cells.saturating_mul(cell_dimensions.pixel_width);+ node.second.pixel_width = active_cells.saturating_mul(cell_dimensions.pixel_width);+ }+ (SplitDirection::Vertical, false) => {+ node.first.rows = active_cells;+ node.second.rows = other_cells;+ node.first.pixel_height = active_cells.saturating_mul(cell_dimensions.pixel_height);+ node.second.pixel_height = other_cells.saturating_mul(cell_dimensions.pixel_height);+ }+ (SplitDirection::Vertical, true) => {+ node.first.rows = other_cells;+ node.second.rows = active_cells;+ node.first.pixel_height = other_cells.saturating_mul(cell_dimensions.pixel_height);+ node.second.pixel_height =+ active_cells.saturating_mul(cell_dimensions.pixel_height);+ }+ }+ }++ fn collapse_pane_by_index(+ &mut self,+ pane_index: usize,+ min_cells: usize,+ ) -> Option<CollapsedPaneLayout> {+ if self.zoomed.is_some() {+ return None;+ }++ let mut cursor = self.pane.take()?.cursor();+ let mut index = 0;+ loop {+ if cursor.is_leaf() {+ if index == pane_index {+ break;+ }+ index += 1;+ }+ match cursor.preorder_next() {+ Ok(c) => cursor = c,+ Err(c) => {+ self.pane.replace(c.tree());+ return None;+ }+ }+ }++ let pane_stack_id = match cursor.leaf_mut().map(|stack| stack.id()) {+ Some(pane_stack_id) => pane_stack_id,+ None => {+ self.pane.replace(cursor.tree());+ return None;+ }+ };+ let (branch, parent_node) = match cursor.path_to_root().next() {+ Some((branch, Some(parent_node))) => (branch, *parent_node),+ _ => {+ self.pane.replace(cursor.tree());+ return None;+ }+ };+ let active_is_second = branch == PathBranch::IsRight;+ let active_cells_before = Self::split_branch_cells(&parent_node, active_is_second);++ match cursor.go_up() {+ Ok(mut parent_cursor) => {+ let cell_dimensions = self.cell_dimensions();+ if let Ok(Some(node)) = parent_cursor.node_mut() {+ let layout = CollapsedPaneLayout {+ pane_stack_id,+ split_direction: node.direction,+ active_is_second,+ active_cells_before,+ };+ Self::set_split_branch_cells(+ node,+ active_is_second,+ min_cells,+ cell_dimensions,+ );+ self.cascade_size_from_cursor(parent_cursor);+ Some(layout)+ } else {+ self.pane.replace(parent_cursor.tree());+ None+ }+ }+ Err(c) => {+ self.pane.replace(c.tree());+ None+ }+ }+ }++ fn restore_collapsed_pane(&mut self, layout: CollapsedPaneLayout) -> bool {+ if self.zoomed.is_some() {+ return false;+ }++ let mut cursor = match self.pane.take() {+ Some(tree) => tree.cursor(),+ None => return false,+ };+ loop {+ if cursor.is_leaf() {+ let contains_pane = cursor+ .leaf_mut()+ .is_some_and(|stack| stack.id() == layout.pane_stack_id);+ if contains_pane {+ break;+ }+ }+ match cursor.preorder_next() {+ Ok(c) => cursor = c,+ Err(c) => {+ self.pane.replace(c.tree());+ return false;+ }+ }+ }++ match cursor.go_up() {+ Ok(mut parent_cursor) => {+ let cell_dimensions = self.cell_dimensions();+ if let Ok(Some(node)) = parent_cursor.node_mut() {+ if node.direction != layout.split_direction {+ self.pane.replace(parent_cursor.tree());+ return false;+ }+ Self::set_split_branch_cells(+ node,+ layout.active_is_second,+ layout.active_cells_before,+ cell_dimensions,+ );+ self.cascade_size_from_cursor(parent_cursor);+ true+ } else {+ self.pane.replace(parent_cursor.tree());+ false+ }+ }+ Err(c) => {+ self.pane.replace(c.tree());+ false+ }+ }+ }++ fn reapply_collapsed_pane(&mut self, layout: CollapsedPaneLayout, min_cells: usize) -> bool {+ if self.zoomed.is_some() {+ return false;+ }++ let mut cursor = match self.pane.take() {+ Some(tree) => tree.cursor(),+ None => return false,+ };+ loop {+ if cursor.is_leaf() {+ let contains_pane = cursor+ .leaf_mut()+ .is_some_and(|stack| stack.id() == layout.pane_stack_id);+ if contains_pane {+ break;+ }+ }+ match cursor.preorder_next() {+ Ok(c) => cursor = c,+ Err(c) => {+ self.pane.replace(c.tree());+ return false;+ }+ }+ }++ match cursor.go_up() {+ Ok(mut parent_cursor) => {+ let cell_dimensions = self.cell_dimensions();+ if let Ok(Some(node)) = parent_cursor.node_mut() {+ if node.direction != layout.split_direction {+ self.pane.replace(parent_cursor.tree());+ return false;+ }+ Self::set_split_branch_cells(+ node,+ layout.active_is_second,+ min_cells,+ cell_dimensions,+ );+ self.cascade_size_from_cursor(parent_cursor);+ true+ } else {+ self.pane.replace(parent_cursor.tree());+ false+ }+ }+ Err(c) => {+ self.pane.replace(c.tree());+ false+ }+ }+ }+fn cascade_size_from_cursor(&mut self, mut cursor: Cursor) {// Now we need to cascade this down to childrenmatch cursor.preorder_next() {diff --git a/wezterm-gui/build.rs b/wezterm-gui/build.rsindex 1376ca06..db9d24b3 100644--- a/wezterm-gui/build.rs+++ b/wezterm-gui/build.rs@@ -174,8 +174,14 @@ ENDlet dest_plist = build_target_dir.join("Info.plist");let src_icon = repo_dir.join("assets").join("icon").join("ThinkTerm.icns");let dest_icon = build_target_dir.join("ThinkTerm.icns");+ let src_simple_icon = repo_dir+ .join("assets")+ .join("icon")+ .join("ThinkTerm_simple.icns");+ let dest_simple_icon = build_target_dir.join("ThinkTerm_simple.icns");println!("cargo:rerun-if-changed=assets/macos/ThinkTerm.app/Contents/Info.plist");println!("cargo:rerun-if-changed=assets/icon/ThinkTerm.icns");+ println!("cargo:rerun-if-changed=assets/icon/ThinkTerm_simple.icns");std::fs::copy(&src_plist, &dest_plist).context(format!(@@ -192,5 +198,13 @@ ENDdest_icon.display())).unwrap();++ std::fs::copy(&src_simple_icon, &dest_simple_icon)+ .context(format!(+ "copy {} -> {}",+ src_simple_icon.display(),+ dest_simple_icon.display()+ ))+ .unwrap();}}diff --git a/wezterm-gui/src/glyphcache.rs b/wezterm-gui/src/glyphcache.rsindex 7542910a..3e6909b5 100644--- a/wezterm-gui/src/glyphcache.rs+++ b/wezterm-gui/src/glyphcache.rs@@ -586,7 +586,36 @@ pub struct GlyphCache {min_frame_duration: Duration,}+#[derive(Debug, Clone)]+pub struct GlyphCacheStats {+ pub atlas_size: usize,+ pub glyphs: usize,+ pub decoded_images: usize,+ pub image_frames: usize,+ pub line_glyphs: usize,+ pub block_glyphs: usize,+ pub svg_icons: usize,+ pub rotated_svg_icons: usize,+ pub cursor_glyphs: usize,+ pub color_sprites: usize,+}+impl GlyphCache {+ pub fn stats(&self) -> GlyphCacheStats {+ GlyphCacheStats {+ atlas_size: self.atlas.size(),+ glyphs: self.glyph_cache.len(),+ decoded_images: self.image_cache.len(),+ image_frames: self.frame_cache.len(),+ line_glyphs: self.line_glyphs.len(),+ block_glyphs: self.block_glyphs.len(),+ svg_icons: self.svg_icons.len(),+ rotated_svg_icons: self.rotated_svg_icons.len(),+ cursor_glyphs: self.cursor_glyphs.len(),+ color_sprites: self.color.len(),+ }+ }+pub fn new_in_memory(fonts: &Rc<FontConfiguration>, size: usize) -> anyhow::Result<Self> {let surface: Rc<dyn Texture2d> = Rc::new(ImageTexture::new(size, size));let atlas = Atlas::new(&surface).expect("failed to create new texture atlas");diff --git a/wezterm-gui/src/native_settings.rs b/wezterm-gui/src/native_settings.rsindex 4552acbd..4d455b3f 100644--- a/wezterm-gui/src/native_settings.rs+++ b/wezterm-gui/src/native_settings.rs@@ -50,10 +50,40 @@ impl NativeThemeMode {}}+#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]+#[serde(rename_all = "lowercase")]+pub(crate) enum NativeAppIcon {+ Default,+ Simple,+}++impl Default for NativeAppIcon {+ fn default() -> Self {+ Self::Default+ }+}++impl NativeAppIcon {+ pub(crate) fn label(self) -> &'static str {+ match self {+ Self::Default => "Default",+ Self::Simple => "Simple",+ }+ }++ fn file_name(self) -> &'static str {+ match self {+ Self::Default => "ThinkTerm.icns",+ Self::Simple => "ThinkTerm_simple.icns",+ }+ }+}+#[derive(Debug, Clone, Default, Deserialize, Serialize)]#[serde(default)]pub(crate) struct NativeAppearanceSettings {pub(crate) theme_mode: NativeThemeMode,+ pub(crate) app_icon: NativeAppIcon,}#[derive(Debug, Clone, Default, Deserialize, Serialize)]@@ -179,6 +209,47 @@ pub(crate) fn apply_to_app(settings: &ThinkTermNativeSettings) {if let Some(conn) = Connection::get() {conn.set_preferred_appearance(settings.appearance.theme_mode.preferred_app_appearance());}++ #[cfg(target_os = "macos")]+ if let Some(path) = app_icon_path(settings.appearance.app_icon) {+ if let Err(err) = window::set_application_icon_from_file(&path) {+ log::warn!(+ "Unable to apply ThinkTerm app icon {} from {}: {err:#}",+ settings.appearance.app_icon.label(),+ path.display()+ );+ }+ }+}++#[cfg(target_os = "macos")]+pub(crate) fn app_icon_path(icon: NativeAppIcon) -> Option<PathBuf> {+ let file_name = icon.file_name();+ let mut candidates = Vec::new();++ if let Ok(exe) = std::env::current_exe() {+ if let Some(exe_dir) = exe.parent() {+ candidates.push(exe_dir.join(file_name));+ if let Some(contents_dir) = exe_dir.parent() {+ candidates.push(contents_dir.join("Resources").join(file_name));+ }+ }+ }++ if let Some(repo_dir) = PathBuf::from(env!("CARGO_MANIFEST_DIR")).parent() {+ candidates.push(repo_dir.join("assets").join("icon").join(file_name));+ candidates.push(+ repo_dir+ .join("assets")+ .join("macos")+ .join("ThinkTerm.app")+ .join("Contents")+ .join("Resources")+ .join(file_name),+ );+ }++ candidates.into_iter().find(|path| path.exists())}pub(crate) fn settings_font_size(settings: &ThinkTermNativeSettings) -> f64 {diff --git a/wezterm-gui/src/project_sessions.rs b/wezterm-gui/src/project_sessions.rsindex dc06dfec..ce20c951 100644--- a/wezterm-gui/src/project_sessions.rs+++ b/wezterm-gui/src/project_sessions.rs@@ -49,6 +49,10 @@ pub struct Session {pub is_pinned: bool,#[serde(default)]pub is_unread: bool,+ #[serde(skip)]+ pub work_is_running: bool,+ #[serde(default)]+ pub work_finished_unseen: bool,#[serde(default)]pub archived: bool,}@@ -95,10 +99,19 @@ pub struct ProjectView {pub struct SessionView {pub id: SessionId,pub name: String,+ pub workspace_name: String,pub is_active: bool,pub is_materialized: bool,pub is_pinned: bool,pub is_unread: bool,+ pub work_finished_unseen: bool,+}++#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub enum SessionWorkStatus {+ Idle,+ Running,+ FinishedUnseen,}#[derive(Debug, Clone, PartialEq, Eq)]@@ -267,6 +280,24 @@ pub fn activate_session_record(plan}+pub fn observe_session_work(session_id: &str, is_working: bool) -> Option<SessionWorkStatus> {+ let mut store = SESSION_STORE.lock();+ let (status, changed) = store.observe_session_work(session_id, is_working)?;+ if changed {+ persist_locked(&store);+ }+ Some(status)+}++pub fn acknowledge_session_work_for_workspace(workspace: &str) -> bool {+ let mut store = SESSION_STORE.lock();+ let changed = store.acknowledge_session_work_for_workspace(workspace);+ if changed {+ persist_locked(&store);+ }+ changed+}+pub fn snapshot_workspace_layout_with_font_scales<F>(workspace: &str,window_id: MuxWindowId,@@ -465,19 +496,21 @@ fn session_views_for_project(.iter().filter(|session| !session.archived).map(|session| {- let is_materialized = session+ let workspace_name = session.materialized_workspace_name- .as_ref()- .map(|workspace| live_workspaces.iter().any(|live| live == workspace))- .unwrap_or(false);+ .clone()+ .unwrap_or_else(|| workspace_name_for_session(&project.id, &session.id));+ let is_materialized = live_workspaces.iter().any(|live| live == &workspace_name);SessionView {id: session.id.clone(),name: session.name.clone(),+ workspace_name,is_active: project_is_active&& project.active_session_id.as_deref() == Some(&session.id),is_materialized,is_pinned: session.is_pinned,is_unread: session.is_unread,+ work_finished_unseen: session.work_finished_unseen,}}).collect()@@ -700,6 +733,7 @@ impl SessionStore {session.materialized_workspace_name = Some(workspace_name.clone());session.last_active_at = now_ts();session.is_unread = false;+ session.work_finished_unseen = false;project.active_session_id = Some(session.id.clone());self.active_project_id = Some(project.id.clone());Some(ActivationPlan {@@ -810,6 +844,61 @@ impl SessionStore {false}+ fn observe_session_work(+ &mut self,+ session_id: &str,+ is_working: bool,+ ) -> Option<(SessionWorkStatus, bool)> {+ for project in &mut self.projects {+ if let Some(session) = project+ .sessions+ .iter_mut()+ .find(|session| session.id == session_id)+ {+ if is_working {+ let changed = !session.work_is_running || session.work_finished_unseen;+ session.work_is_running = true;+ session.work_finished_unseen = false;+ return Some((SessionWorkStatus::Running, changed));+ }++ let changed = if session.work_is_running {+ session.work_is_running = false;+ session.work_finished_unseen = true;+ true+ } else {+ false+ };+ let status = if session.work_finished_unseen {+ SessionWorkStatus::FinishedUnseen+ } else {+ SessionWorkStatus::Idle+ };+ return Some((status, changed));+ }+ }+ None+ }++ fn acknowledge_session_work_for_workspace(&mut self, workspace: &str) -> bool {+ for project in &mut self.projects {+ let project_id = project.id.clone();+ for session in &mut project.sessions {+ let session_workspace = session+ .materialized_workspace_name+ .clone()+ .unwrap_or_else(|| workspace_name_for_session(&project_id, &session.id));+ if session_workspace == workspace {+ let changed = session.work_is_running || session.work_finished_unseen;+ session.work_is_running = false;+ session.work_finished_unseen = false;+ return changed;+ }+ }+ }+ false+ }+fn archive_session(&mut self, session_id: &str) -> bool {for project in &mut self.projects {if project.active_session_id.as_deref() == Some(session_id) {@@ -938,6 +1027,8 @@ impl Session {last_active_at: now_ts(),is_pinned: false,is_unread: false,+ work_is_running: false,+ work_finished_unseen: false,archived: false,}}@@ -1423,6 +1514,38 @@ mod tests {assert_eq!(loaded.projects[0].sessions[0].name, "main");}+ #[test]+ fn running_work_state_is_runtime_only() {+ let dir = tempdir().unwrap();+ let path = dir.path().join("sessions.json");+ let mut store = SessionStore::default();+ let mut session = Session::new("project-1".to_string(), "main".to_string(), None);+ session.work_is_running = true;+ store.projects.push(Project {+ id: "project-1".to_string(),+ name: "thinkterm".to_string(),+ path: PathBuf::from("/tmp/thinkterm"),+ sessions: vec![session],+ active_session_id: None,+ sessions_collapsed: false,+ });++ save_session_store_to_path(&path, &store).unwrap();+ let json = std::fs::read_to_string(&path).unwrap();+ assert!(!json.contains("work_is_running"));++ let legacy_json = json.replace(+ "\"work_finished_unseen\": false",+ "\"work_is_running\": true,\n \"work_finished_unseen\": false",+ );+ assert_ne!(legacy_json, json);+ std::fs::write(&path, legacy_json).unwrap();++ let loaded = load_session_store_from_path(&path).unwrap();+ assert!(!loaded.projects[0].sessions[0].work_is_running);+ assert!(!loaded.projects[0].sessions[0].work_finished_unseen);+ }+#[test]fn inactive_session_activation_materializes_once() {let mut store = SessionStore::default();diff --git a/wezterm-gui/src/renderstate.rs b/wezterm-gui/src/renderstate.rsindex 219d707f..da865d0d 100644--- a/wezterm-gui/src/renderstate.rs+++ b/wezterm-gui/src/renderstate.rs@@ -6,6 +6,7 @@ use ::window::bitmaps::atlas::OutOfTextureSpace;use ::window::bitmaps::Texture2d;use ::window::glium::backend::Context as GliumContext;use ::window::glium::buffer::{BufferMutSlice, Mapping};+use ::window::glium::texture::SrgbTexture2d;use ::window::glium::{CapabilitiesSource, IndexBuffer as GliumIndexBuffer, VertexBuffer as GliumVertexBuffer,};@@ -19,6 +20,61 @@ use wgpu::util::DeviceExt;const INDICES_PER_CELL: usize = 6;+fn gpu_debug_enabled() -> bool {+ std::env::var_os("THINKTERM_GPU_DEBUG").is_some()+}++fn gpu_debug(message: impl AsRef<str>) {+ if gpu_debug_enabled() {+ log::info!("[gpu-resource] {}", message.as_ref());+ }+}++pub(crate) struct LoggedSrgbTexture2d {+ inner: SrgbTexture2d,+ label: &'static str,+}++impl LoggedSrgbTexture2d {+ pub(crate) fn new(inner: SrgbTexture2d, label: &'static str) -> Self {+ Self { inner, label }+ }++ pub(crate) fn inner(&self) -> &SrgbTexture2d {+ &self.inner+ }+}++impl Texture2d for LoggedSrgbTexture2d {+ fn write(&self, rect: Rect, im: &dyn BitmapImage) {+ <SrgbTexture2d as Texture2d>::write(&self.inner, rect, im);+ }++ fn read(&self, rect: Rect, im: &mut dyn BitmapImage) {+ <SrgbTexture2d as Texture2d>::read(&self.inner, rect, im);+ }++ fn width(&self) -> usize {+ <SrgbTexture2d as Texture2d>::width(&self.inner)+ }++ fn height(&self) -> usize {+ <SrgbTexture2d as Texture2d>::height(&self.inner)+ }+}++impl Drop for LoggedSrgbTexture2d {+ fn drop(&mut self) {+ gpu_debug(format!(+ "drop OpenGL texture label={} size={}x{} bytes={}",+ self.label,+ self.width(),+ self.height(),+ self.width() * self.height() * 4+ ));+ }+}+#[derive(Clone)]pub enum RenderContext {Glium(Rc<GliumContext>),@@ -56,21 +112,36 @@ impl RenderContext {num_quads: usize,initializer: &[Vertex],) -> anyhow::Result<VertexBuffer> {+ let bytes = num_quads * VERTICES_PER_CELL * std::mem::size_of::<Vertex>();match self {- Self::Glium(context) => Ok(VertexBuffer::Glium(GliumVertexBuffer::dynamic(- context,- initializer,- )?)),- Self::WebGpu(state) => Ok(VertexBuffer::WebGpu(WebGpuVertexBuffer::new(- num_quads * VERTICES_PER_CELL,- state,- ))),+ Self::Glium(context) => {+ gpu_debug(format!(+ "create OpenGL vertex_buffer quads={num_quads} bytes={bytes}"+ ));+ Ok(VertexBuffer::Glium(GliumVertexBuffer::dynamic(+ context,+ initializer,+ )?))+ }+ Self::WebGpu(state) => {+ gpu_debug(format!(+ "create WebGpu vertex_buffer quads={num_quads} bytes={bytes}"+ ));+ Ok(VertexBuffer::WebGpu(WebGpuVertexBuffer::new(+ num_quads * VERTICES_PER_CELL,+ state,+ )))+ }}}pub fn allocate_texture_atlas(&self, size: usize) -> anyhow::Result<Rc<dyn Texture2d>> {+ let bytes = size * size * 4;match self {Self::Glium(context) => {+ gpu_debug(format!(+ "create OpenGL texture_atlas size={size}x{size} bytes={bytes}"+ ));let caps = context.get_capabilities();// You'd hope that allocating a texture would automatically// include this check, but it doesn't, and instead, the texture@@ -88,17 +159,21 @@ impl RenderContext {caps.max_texture_size);}- use crate::glium::texture::SrgbTexture2d;- let surface: Rc<dyn Texture2d> = Rc::new(SrgbTexture2d::empty_with_format(+ let surface = SrgbTexture2d::empty_with_format(context,glium::texture::SrgbFormat::U8U8U8U8,glium::texture::MipmapsOption::NoMipmap,size as u32,size as u32,- )?);+ )?;+ let surface: Rc<dyn Texture2d> =+ Rc::new(LoggedSrgbTexture2d::new(surface, "Texture Atlas"));Ok(surface)}Self::WebGpu(state) => {+ gpu_debug(format!(+ "create WebGpu texture_atlas size={size}x{size} bytes={bytes}"+ ));let texture: Rc<dyn Texture2d> =Rc::new(WebGpuTexture::new(size as u32, size as u32, state)?);Ok(texture)@@ -146,6 +221,22 @@ pub enum VertexBuffer {WebGpu(WebGpuVertexBuffer),}+impl Drop for VertexBuffer {+ fn drop(&mut self) {+ if !gpu_debug_enabled() {+ return;+ }+ match self {+ Self::Glium(_) => gpu_debug("drop OpenGL vertex_buffer"),+ Self::WebGpu(vb) => gpu_debug(format!(+ "drop WebGpu vertex_buffer vertices={} bytes={}",+ vb.num_vertices,+ vb.num_vertices * std::mem::size_of::<Vertex>()+ )),+ }+ }+}+impl VertexBuffer {pub fn glium(&self) -> &GliumVertexBuffer<Vertex> {match self {@@ -500,11 +591,20 @@ impl RenderLayer {}pub fn reallocate_quads(&self, idx: usize, num_quads: usize) -> anyhow::Result<()> {+ let old_capacity = self.vb.borrow()[idx].capacity;+ gpu_debug(format!(+ "reallocate layer zindex={} vb_idx={idx} old_quads={old_capacity} new_quads={num_quads}",+ self.zindex+ ));let vb = Self::compute_vertices(&self.context, num_quads)?;self.vb.borrow_mut()[idx] = vb;Ok(())}+ fn total_quad_capacity(&self) -> usize {+ self.vb.borrow().iter().map(|vb| vb.capacity).sum()+ }+/// Compute a vertex buffer to hold the quads that comprise the visible/// portion of the screen. We recreate this when the screen is resized./// The idea is that we want to minimize any heavy lifting and computation@@ -578,6 +678,24 @@ pub struct RenderState {pub layers: RefCell<Vec<Rc<RenderLayer>>>,}+#[derive(Debug, Clone)]+pub struct RenderStateStats {+ pub backend: &'static str,+ pub atlas_size: usize,+ pub glyphs: usize,+ pub decoded_images: usize,+ pub image_frames: usize,+ pub line_glyphs: usize,+ pub block_glyphs: usize,+ pub svg_icons: usize,+ pub rotated_svg_icons: usize,+ pub cursor_glyphs: usize,+ pub color_sprites: usize,+ pub layers: usize,+ pub layer_quads: usize,+ pub vertex_buffers: usize,+}+impl RenderState {pub fn new(context: RenderContext,@@ -716,6 +834,34 @@ impl RenderState {self.glyph_cache.borrow_mut().config_changed();}+ pub fn stats(&self) -> RenderStateStats {+ let glyph = self.glyph_cache.borrow().stats();+ let layers = self.layers.borrow();+ let layer_quads = layers+ .iter()+ .map(|layer| layer.total_quad_capacity())+ .sum::<usize>();+ RenderStateStats {+ backend: match &self.context {+ RenderContext::Glium(_) => "OpenGL",+ RenderContext::WebGpu(_) => "WebGpu",+ },+ atlas_size: glyph.atlas_size,+ glyphs: glyph.glyphs,+ decoded_images: glyph.decoded_images,+ image_frames: glyph.image_frames,+ line_glyphs: glyph.line_glyphs,+ block_glyphs: glyph.block_glyphs,+ svg_icons: glyph.svg_icons,+ rotated_svg_icons: glyph.rotated_svg_icons,+ cursor_glyphs: glyph.cursor_glyphs,+ color_sprites: glyph.color_sprites,+ layers: layers.len(),+ layer_quads,+ vertex_buffers: layers.len() * 3,+ }+ }+pub fn recreate_texture_atlas(&mut self,fonts: &Rc<FontConfiguration>,@@ -761,6 +907,7 @@ impl RenderState {size: Option<usize>,) -> anyhow::Result<()> {let size = size.unwrap_or_else(|| self.glyph_cache.borrow().atlas.size());+ gpu_debug(format!("recreate texture_atlas requested_size={size}"));let mut new_glyph_cache = GlyphCache::new_gl(&self.context, fonts, size)?;self.util_sprites = UtilSprites::new(&mut new_glyph_cache, metrics)?;diff --git a/wezterm-gui/src/settings_window.rs b/wezterm-gui/src/settings_window.rsindex dd643a17..a3e531f6 100644--- a/wezterm-gui/src/settings_window.rs+++ b/wezterm-gui/src/settings_window.rs@@ -17,6 +17,7 @@ use anyhow::Context;use config::{configuration, Dimension, GeometryOrigin};use std::cell::RefCell;use std::path::PathBuf;+use std::process::Command;use std::rc::Rc;use std::time::{Duration, Instant};use wezterm_bidi::Direction;@@ -30,7 +31,7 @@ use window::{};use crate::native_settings::{- NativeThemeMode, ThinkTermNativeSettings, DEFAULT_PANE_HEADER_FONT_SIZE,+ NativeAppIcon, NativeThemeMode, ThinkTermNativeSettings, DEFAULT_PANE_HEADER_FONT_SIZE,DEFAULT_SETTINGS_FONT_SIZE, DEFAULT_SIDEBAR_FONT_SIZE, DEFAULT_TAB_FONT_SIZE,};@@ -129,6 +130,7 @@ impl SettingsSection {"Theme Mode","Effective Color Scheme","Config Source",+ "App Icon","Settings UI Font Size","Workspace Sidebar Font Size","Tab Bar Font Size",@@ -204,6 +206,8 @@ enum SettingsAction {CopyMemorySnapshot,ToggleThemeModeMenu,SetThemeMode(NativeThemeMode),+ ToggleAppIconMenu,+ SetAppIcon(NativeAppIcon),SearchInput,DecreaseFontSize,IncreaseFontSize,@@ -229,6 +233,7 @@ enum SettingsDrag {#[derive(Debug, Clone, Copy, PartialEq, Eq)]enum SettingsDropdown {ThemeMode,+ AppIcon,}#[derive(Debug, Clone)]@@ -238,13 +243,27 @@ struct MemorySnapshot {resident_size: Option<u64>,physical_footprint: Option<u64>,peak_physical_footprint: Option<u64>,+ vmmap_total_resident: Option<u64>,+ vmmap_graphics_resident: Option<u64>,+ vmmap_malloc_resident: Option<u64>,+ vmmap_text_resident: Option<u64>,+ vmmap_iosurface_resident: Option<u64>,+ vmmap_error: Option<String>,error: Option<String>,}impl MemorySnapshot {+ fn has_vmmap_breakdown(&self) -> bool {+ self.vmmap_total_resident.is_some()+ || self.vmmap_graphics_resident.is_some()+ || self.vmmap_malloc_resident.is_some()+ || self.vmmap_text_resident.is_some()+ || self.vmmap_iosurface_resident.is_some()+ }+fn log_line(&self) -> String {format!(- "pid={} rss={} physical_footprint={} peak_physical_footprint={}{}",+ "pid={} rss={} physical_footprint={} peak_physical_footprint={} vmmap_total_resident={} graphics_resident={} malloc_resident={}{}{}",self.pid,self.resident_size.map(format_bytes)@@ -255,6 +274,19 @@ impl MemorySnapshot {self.peak_physical_footprint.map(format_bytes).unwrap_or_else(|| "unavailable".to_string()),+ self.vmmap_total_resident+ .map(format_bytes)+ .unwrap_or_else(|| "unavailable".to_string()),+ self.vmmap_graphics_resident+ .map(format_bytes)+ .unwrap_or_else(|| "unavailable".to_string()),+ self.vmmap_malloc_resident+ .map(format_bytes)+ .unwrap_or_else(|| "unavailable".to_string()),+ self.vmmap_error+ .as_ref()+ .map(|error| format!(" vmmap_error={error}"))+ .unwrap_or_default(),self.error.as_ref().map(|error| format!(" error={error}"))@@ -284,7 +316,40 @@ impl MemorySnapshot {.map(format_bytes).unwrap_or_else(|| "unavailable".to_string())),+ format!(+ "vmmap_total_resident: {}",+ self.vmmap_total_resident+ .map(format_bytes)+ .unwrap_or_else(|| "not captured".to_string())+ ),+ format!(+ "graphics_resident: {}",+ self.vmmap_graphics_resident+ .map(format_bytes)+ .unwrap_or_else(|| "not captured".to_string())+ ),+ format!(+ "iosurface_resident: {}",+ self.vmmap_iosurface_resident+ .map(format_bytes)+ .unwrap_or_else(|| "not captured".to_string())+ ),+ format!(+ "malloc_resident: {}",+ self.vmmap_malloc_resident+ .map(format_bytes)+ .unwrap_or_else(|| "not captured".to_string())+ ),+ format!(+ "text_segments_resident: {}",+ self.vmmap_text_resident+ .map(format_bytes)+ .unwrap_or_else(|| "not captured".to_string())+ ),];+ if let Some(error) = &self.vmmap_error {+ lines.push(format!("vmmap_error: {error}"));+ }if let Some(error) = &self.error {lines.push(format!("error: {error}"));}@@ -344,6 +409,7 @@ struct SettingsUiState {memory_monitoring: bool,memory_monitor_generation: u64,memory_snapshot: Option<MemorySnapshot>,+ main_window_resource_lines: Vec<String>,memory_snapshot_copied_until: Option<Instant>,sidebar_scrollbar_visible_until: Option<Instant>,content_scrollbar_visible_until: Option<Instant>,@@ -370,6 +436,7 @@ impl SettingsUiState {memory_monitoring: false,memory_monitor_generation: 0,memory_snapshot: None,+ main_window_resource_lines: Vec::new(),memory_snapshot_copied_until: None,sidebar_scrollbar_visible_until: None,content_scrollbar_visible_until: None,@@ -386,7 +453,7 @@ fn format_bytes(bytes: u64) -> String {}}-fn capture_memory_snapshot() -> MemorySnapshot {+fn capture_memory_snapshot(detailed: bool) -> MemorySnapshot {let pid = std::process::id();let mut snapshot = MemorySnapshot {captured_at: Instant::now(),@@ -394,6 +461,12 @@ fn capture_memory_snapshot() -> MemorySnapshot {resident_size: None,physical_footprint: None,peak_physical_footprint: None,+ vmmap_total_resident: None,+ vmmap_graphics_resident: None,+ vmmap_malloc_resident: None,+ vmmap_text_resident: None,+ vmmap_iosurface_resident: None,+ vmmap_error: None,error: None,};@@ -408,9 +481,172 @@ fn capture_memory_snapshot() -> MemorySnapshot {}}+ if detailed {+ match capture_vmmap_breakdown(pid) {+ Ok(breakdown) => {+ snapshot.vmmap_total_resident = breakdown.total_resident;+ snapshot.vmmap_graphics_resident = breakdown.graphics_resident;+ snapshot.vmmap_malloc_resident = breakdown.malloc_resident;+ snapshot.vmmap_text_resident = breakdown.text_resident;+ snapshot.vmmap_iosurface_resident = breakdown.iosurface_resident;+ }+ Err(err) => {+ snapshot.vmmap_error = Some(err);+ }+ }+ }+snapshot}+#[derive(Debug, Clone, Default)]+struct VmmapBreakdown {+ total_resident: Option<u64>,+ graphics_resident: Option<u64>,+ malloc_resident: Option<u64>,+ text_resident: Option<u64>,+ iosurface_resident: Option<u64>,+}++fn capture_vmmap_breakdown(pid: u32) -> Result<VmmapBreakdown, String> {+ let output = Command::new("/usr/bin/vmmap")+ .arg("-summary")+ .arg(pid.to_string())+ .output()+ .map_err(|err| format!("failed to run vmmap: {err}"))?;++ if !output.status.success() {+ let stderr = String::from_utf8_lossy(&output.stderr);+ return Err(stderr.trim().to_string());+ }++ parse_vmmap_summary(&String::from_utf8_lossy(&output.stdout))+}++fn parse_vmmap_summary(summary: &str) -> Result<VmmapBreakdown, String> {+ let mut result = VmmapBreakdown::default();+ let mut graphics_resident = 0;+ let mut has_graphics = false;+ let mut malloc_resident = 0;+ let mut has_malloc = false;+ let mut in_region_table = false;++ for line in summary.lines() {+ let trimmed = line.trim_start();+ if trimmed.starts_with("REGION TYPE") {+ in_region_table = true;+ continue;+ }+ if !in_region_table || trimmed.is_empty() || trimmed.starts_with("==========") {+ continue;+ }++ let Some((name, values)) = parse_vmmap_region_line(line) else {+ continue;+ };+ if values.len() < 2 {+ continue;+ }+ let resident = values[1];+ let name = name.trim();++ if name == "TOTAL" {+ result.total_resident = Some(resident);+ break;+ } else if name == "__TEXT" {+ result.text_resident = Some(resident);+ } else if name == "IOSurface" {+ result.iosurface_resident = Some(resident);+ graphics_resident += resident;+ has_graphics = true;+ } else if name == "IOAccelerator (graphics)" || name == "owned unmapped (graphics)" {+ graphics_resident += resident;+ has_graphics = true;+ } else if name.starts_with("MALLOC") {+ malloc_resident += resident;+ has_malloc = true;+ }+ }++ if has_graphics {+ result.graphics_resident = Some(graphics_resident);+ }+ if has_malloc {+ result.malloc_resident = Some(malloc_resident);+ }+ Ok(result)+}++fn parse_vmmap_region_line(line: &str) -> Option<(String, Vec<u64>)> {+ let tokens: Vec<&str> = line.split_whitespace().collect();+ let first_size = tokens+ .iter()+ .position(|token| parse_vmmap_size(token).is_some())?;+ if first_size == 0 {+ return None;+ }+ let name = tokens[..first_size].join(" ");+ let values = tokens[first_size..]+ .iter()+ .filter_map(|token| parse_vmmap_size(token))+ .collect::<Vec<_>>();+ Some((name, values))+}++fn parse_vmmap_size(token: &str) -> Option<u64> {+ let token = token.trim_end_matches(',');+ let (number, multiplier) = if let Some(number) = token.strip_suffix('K') {+ (number, 1024.0)+ } else if let Some(number) = token.strip_suffix('M') {+ (number, 1024.0 * 1024.0)+ } else if let Some(number) = token.strip_suffix('G') {+ (number, 1024.0 * 1024.0 * 1024.0)+ } else {+ return None;+ };+ number+ .parse::<f64>()+ .ok()+ .map(|value| (value * multiplier).round() as u64)+}++#[cfg(test)]+mod memory_parser_tests {+ use super::*;++ #[test]+ fn vmmap_summary_uses_region_type_table_total() {+ let summary = r#"+ReadOnly portion of Libraries: Total=579.0M resident=421.4M(73%) swapped_out_or_unallocated=157.6M(27%)+Writable regions: Total=81.0M written=19.4M(24%) resident=19.4M(24%) swapped_out=0K(0%) unallocated=61.6M(76%)++ VIRTUAL RESIDENT DIRTY SWAPPED VOLATILE NONVOL EMPTY REGION+REGION TYPE SIZE SIZE SIZE SIZE SIZE SIZE SIZE COUNT (non-coalesced)+=========== ======= ======== ===== ======= ======== ====== ===== =======+MALLOC metadata 752K 192K 192K 0K 0K 0K 0K 4+IOSurface 96.0M 82.6M 64K 0K 0K 0K 0K 2+IOAccelerator (graphics) 64.0M 36.2M 16K 0K 0K 0K 0K 1+__TEXT 430.0M 421.4M 0K 0K 0K 0K 0K 46+=========== ======= ======== ===== ======= ======== ====== ===== =======+TOTAL 802.4M 563.7M 19.8M 0K 0K 0K 0K 261++MALLOC ZONE SIZE SIZE SIZE SIZE COUNT ALLOCATED FRAG SIZE % FRAG COUNT+=========== ======= ========= ========= ========= ========= ========= ========= ====== ======+TOTAL 94.4M 19.3M 19.3M 0K 184 11K 245K 96% 5+"#;++ let parsed = parse_vmmap_summary(summary).unwrap();+ assert_eq!(parsed.total_resident, parse_vmmap_size("563.7M"));+ assert_eq!(parsed.iosurface_resident, parse_vmmap_size("82.6M"));+ assert_eq!(+ parsed.graphics_resident,+ Some(parse_vmmap_size("82.6M").unwrap() + parse_vmmap_size("36.2M").unwrap())+ );+ assert_eq!(parsed.malloc_resident, Some(192 * 1024));+ assert_eq!(parsed.text_resident, parse_vmmap_size("421.4M"));+ }+}+#[derive(Debug, Clone, Copy)]struct ProcessMemoryInfo {resident_size: u64,@@ -673,6 +909,12 @@ impl SettingsWindow {Ok(true)}WindowEvent::Destroyed => {+ self.ui.memory_monitoring = false;+ self.ui.memory_monitor_generation =+ self.ui.memory_monitor_generation.wrapping_add(1);+ self.render_state.take();+ self.webgpu.take();+ self.window.take();SETTINGS_WINDOW.with(|slot| {slot.borrow_mut().take();});@@ -763,7 +1005,12 @@ impl SettingsWindow {});self.ui.open_dropdown = None;}- Some(SettingsAction::ToggleThemeModeMenu | SettingsAction::SetThemeMode(_)) => {+ Some(+ SettingsAction::ToggleThemeModeMenu+ | SettingsAction::SetThemeMode(_)+ | SettingsAction::ToggleAppIconMenu+ | SettingsAction::SetAppIcon(_),+ ) => {self.ui.interaction.focused = None;}Some(_) => {@@ -862,7 +1109,7 @@ impl SettingsWindow {{return;}- let snapshot = capture_memory_snapshot();+ let snapshot = capture_memory_snapshot(false);log::info!("settings memory diagnostics: {}", snapshot.log_line());settings.ui.memory_snapshot = Some(snapshot);window.invalidate();@@ -872,6 +1119,95 @@ impl SettingsWindow {.detach();}+ fn settings_resource_lines(&self) -> Vec<String> {+ let mut lines = vec![format!(+ "Settings window: backend={} size={}x{} dpi={}",+ if self.webgpu.is_some() {+ "WebGpu"+ } else {+ "none"+ },+ self.dimensions.pixel_width,+ self.dimensions.pixel_height,+ self.dimensions.dpi+ )];++ if let Some(render_state) = self.render_state.as_ref() {+ let stats = render_state.stats();+ lines.push(format!(+ "Settings window: render_backend={} atlas={} glyphs={} svg_icons={} rotated_icons={} images={} frames={} blocks={} colors={} cursor_glyphs={}",+ stats.backend,+ stats.atlas_size,+ stats.glyphs,+ stats.svg_icons,+ stats.rotated_svg_icons,+ stats.decoded_images,+ stats.image_frames,+ stats.block_glyphs,+ stats.color_sprites,+ stats.cursor_glyphs,+ ));+ lines.push(format!(+ "Settings window: layers={} vertex_buffers={} quad_capacity={} line_glyphs={}",+ stats.layers, stats.vertex_buffers, stats.layer_quads, stats.line_glyphs+ ));+ } else {+ lines.push("Settings window: render_state=none".to_string());+ }++ lines+ }++ fn memory_resource_lines(&self) -> Vec<String> {+ let mut lines = self.settings_resource_lines();+ if self.ui.main_window_resource_lines.is_empty() {+ lines.push("Main windows: not captured yet; use Refresh Now".to_string());+ } else {+ lines.extend(self.ui.main_window_resource_lines.clone());+ }+ lines+ }++ fn request_main_window_resource_stats(&mut self) {+ let Some(front_end) = crate::frontend::try_front_end() else {+ self.ui.main_window_resource_lines =+ vec!["Main windows: frontend unavailable".to_string()];+ return;+ };+ let windows = front_end.gui_windows();+ if windows.is_empty() {+ self.ui.main_window_resource_lines = vec!["Main windows: none".to_string()];+ return;+ }++ self.ui.main_window_resource_lines =+ vec![format!("Main windows: {} pending", windows.len())];+ for (idx, gui_window) in windows.into_iter().enumerate() {+ let label = format!("Main window {}", idx + 1);+ gui_window+ .window+ .notify(crate::termwindow::TermWindowNotif::Apply(Box::new(+ move |term_window| {+ let lines = term_window.memory_resource_lines(&label);+ SETTINGS_WINDOW.with(|slot| {+ let Some(settings) = slot.borrow().as_ref().cloned() else {+ return;+ };+ let mut settings = settings.borrow_mut();+ settings+ .ui+ .main_window_resource_lines+ .retain(|line| !line.contains(" pending"));+ settings.ui.main_window_resource_lines.extend(lines);+ if let Some(window) = settings.window.as_ref() {+ window.invalidate();+ }+ });+ },+ )));+ }+ }+fn schedule_copied_state_clear(&self, window: &Window) {let window = window.clone();promise::spawn::spawn_into_main_thread(async move {@@ -1411,9 +1747,10 @@ impl SettingsWindow {self.ui.memory_monitor_generation =self.ui.memory_monitor_generation.wrapping_add(1);if self.ui.memory_monitoring {- let snapshot = capture_memory_snapshot();+ let snapshot = capture_memory_snapshot(false);log::info!("settings memory diagnostics: {}", snapshot.log_line());self.ui.memory_snapshot = Some(snapshot);+ self.request_main_window_resource_stats();self.status = "Memory diagnostics are running manually.".to_string();self.schedule_memory_monitor_tick(window, self.ui.memory_monitor_generation);} else {@@ -1422,18 +1759,28 @@ impl SettingsWindow {}SettingsAction::RefreshMemorySnapshot => {self.ui.open_dropdown = None;- let snapshot = capture_memory_snapshot();+ let snapshot = capture_memory_snapshot(true);log::info!("settings memory diagnostics: {}", snapshot.log_line());self.ui.memory_snapshot = Some(snapshot);+ self.request_main_window_resource_stats();self.status = "Memory snapshot refreshed.".to_string();}SettingsAction::CopyMemorySnapshot => {self.ui.open_dropdown = None;- if self.ui.memory_snapshot.is_none() {- self.ui.memory_snapshot = Some(capture_memory_snapshot());+ if self+ .ui+ .memory_snapshot+ .as_ref()+ .is_none_or(|snapshot| !snapshot.has_vmmap_breakdown())+ {+ self.ui.memory_snapshot = Some(capture_memory_snapshot(true));}if let Some(snapshot) = &self.ui.memory_snapshot {- window.set_clipboard(Clipboard::Clipboard, snapshot.summary_for_clipboard());+ let mut summary = snapshot.summary_for_clipboard();+ summary.push_str("\n\nThinkTerm Resource Stats\n");+ summary.push_str(&self.memory_resource_lines().join("\n"));+ window.set_clipboard(Clipboard::Clipboard, summary);+ self.request_main_window_resource_stats();self.ui.memory_snapshot_copied_until =Some(Instant::now() + Duration::from_millis(1400));self.status = "Memory snapshot copied.".to_string();@@ -1464,6 +1811,27 @@ impl SettingsWindow {}}}+ SettingsAction::ToggleAppIconMenu => {+ self.ui.open_dropdown = if self.ui.open_dropdown == Some(SettingsDropdown::AppIcon)+ {+ None+ } else {+ Some(SettingsDropdown::AppIcon)+ };+ }+ SettingsAction::SetAppIcon(icon) => {+ self.native_settings.appearance.app_icon = icon;+ self.ui.open_dropdown = None;+ match crate::native_settings::save(&self.native_settings) {+ Ok(()) => {+ crate::native_settings::apply_to_app(&self.native_settings);+ self.status = format!("App icon is now {}.", icon.label());+ }+ Err(err) => {+ self.status = format!("Unable to save app icon: {err:#}");+ }+ }+ }SettingsAction::SearchInput => {self.ui.interaction.focused = Some(SettingsAction::SearchInput);}@@ -2025,7 +2393,7 @@ impl SettingsWindow {let scroll = self.ui.content_scroll.offset;let row_step = self.settings_row_step();let section_y = CONTENT_SECTION_Y - scroll;- let theme_row_count = 3;+ let theme_row_count = 4;let typography_row_count = 5;let (theme_card_y, mut y) = self.settings_card_geometry(section_y, theme_row_count);let theme_card_height = self.settings_card_height(theme_row_count);@@ -2062,6 +2430,15 @@ impl SettingsWindow {false,)?;y += row_step;+ self.paint_app_icon_row(+ layers,+ row_x,+ y,+ row_width,+ "Switch the running macOS Dock and app switcher icon.",+ true,+ )?;+ y += row_step;self.paint_setting_row(layers,row_x,@@ -2567,13 +2944,10 @@ impl SettingsWindow {let scroll = self.ui.content_scroll.offset;let row_step = self.settings_row_step();let section_y = CONTENT_SECTION_Y - scroll;- let (card_y, first_row_y) = self.settings_card_geometry(section_y, 5);- let card_height = self.settings_card_height(5);+ let row_count = 11;+ let (card_y, first_row_y) = self.settings_card_geometry(section_y, row_count);+ let card_height = self.settings_card_height(row_count);let button_y = card_y + card_height + self.settings_section_card_gap();- self.ui.content_scroll.set_extents(- self.content_bottom(),- self.settings_content_extent(button_y + scroll + CONTROL_HEIGHT),- );self.draw_text(layers,@@ -2589,7 +2963,7 @@ impl SettingsWindow {.ui.memory_snapshot.clone()- .unwrap_or_else(capture_memory_snapshot);+ .unwrap_or_else(|| capture_memory_snapshot(false));if self.ui.memory_snapshot.is_none() {self.ui.memory_snapshot = Some(snapshot.clone());}@@ -2606,11 +2980,46 @@ impl SettingsWindow {.peak_physical_footprint.map(format_bytes).unwrap_or_else(|| "Unavailable".to_string());+ let total_resident = snapshot+ .vmmap_total_resident+ .map(format_bytes)+ .unwrap_or_else(|| "Run Refresh Now".to_string());+ let graphics = snapshot+ .vmmap_graphics_resident+ .map(format_bytes)+ .unwrap_or_else(|| "Run Refresh Now".to_string());+ let iosurface = snapshot+ .vmmap_iosurface_resident+ .map(format_bytes)+ .unwrap_or_else(|| "Run Refresh Now".to_string());+ let malloc = snapshot+ .vmmap_malloc_resident+ .map(format_bytes)+ .unwrap_or_else(|| "Run Refresh Now".to_string());+ let text = snapshot+ .vmmap_text_resident+ .map(format_bytes)+ .unwrap_or_else(|| "Run Refresh Now".to_string());+ let breakdown_status = if snapshot.has_vmmap_breakdown() {+ "Captured"+ } else if snapshot.vmmap_error.is_some() {+ "Unavailable"+ } else {+ "Refresh for vmmap"+ };let monitor_state = if self.ui.memory_monitoring {"Running"} else {"Off"};+ let resource_lines = self.memory_resource_lines();+ let resource_card_y = button_y + CONTROL_HEIGHT + self.settings_section_card_gap();+ let resource_line_height = 30.0;+ let resource_card_height = 88.0 + resource_line_height * resource_lines.len() as f32;+ self.ui.content_scroll.set_extents(+ self.content_bottom(),+ self.settings_content_extent(resource_card_y + scroll + resource_card_height),+ );let card_padding = 36.0;let row_x = x + card_padding;@@ -2666,6 +3075,77 @@ impl SettingsWindow {&age_label,true,)?;+ self.paint_setting_row(+ layers,+ row_x,+ first_row_y + row_step * 5.0,+ row_width,+ "vmmap Breakdown",+ "Refresh Now captures the slower macOS breakdown; sampling keeps this lightweight.",+ breakdown_status,+ true,+ )?;+ self.paint_setting_row(+ layers,+ row_x,+ first_row_y + row_step * 6.0,+ row_width,+ "Activity Monitor Resident",+ "vmmap TOTAL resident; this is the scary-looking number Activity Monitor can resemble.",+ &total_resident,+ true,+ )?;+ self.paint_setting_row(+ layers,+ row_x,+ first_row_y + row_step * 7.0,+ row_width,+ "Graphics Surfaces",+ "IOSurface + IOAccelerator graphics + owned unmapped graphics.",+ &graphics,+ true,+ )?;+ self.paint_setting_row(+ layers,+ row_x,+ first_row_y + row_step * 8.0,+ row_width,+ "IOSurface",+ "macOS window backing surfaces and swapchain-style drawable storage.",+ &iosurface,+ true,+ )?;+ self.paint_setting_row(+ layers,+ row_x,+ first_row_y + row_step * 9.0,+ row_width,+ "Allocator Heap",+ "MALLOC resident from vmmap; Rust allocations mostly land here.",+ &malloc,+ true,+ )?;+ self.paint_setting_row(+ layers,+ row_x,+ first_row_y + row_step * 10.0,+ row_width,+ "Text Segments",+ "__TEXT resident pages from the app, dependencies, and system libraries.",+ &text,+ true,+ )?;+ if let Some(error) = &snapshot.vmmap_error {+ self.draw_text(+ layers,+ &ui_font,+ row_x,+ first_row_y + row_step * 11.0,+ error,+ palette.muted_text,+ row_width,+ )?;+ }let primary_label = if self.ui.memory_monitoring {"Stop Memory Sampling"} else {@@ -2703,6 +3183,28 @@ impl SettingsWindow {SettingsAction::CopyMemorySnapshot,)?;+ self.paint_group_card(layers, x, resource_card_y, max_width, resource_card_height)?;+ self.draw_text(+ layers,+ &ui_font,+ row_x,+ resource_card_y + 28.0,+ "Renderer Resources",+ palette.title,+ row_width,+ )?;+ for (idx, line) in resource_lines.iter().enumerate() {+ self.draw_text(+ layers,+ &ui_font,+ row_x,+ resource_card_y + 66.0 + resource_line_height * idx as f32,+ line,+ palette.secondary_text,+ row_width,+ )?;+ }+Ok(())}@@ -3568,7 +4070,90 @@ impl SettingsWindow {Ok(())}+ fn paint_app_icon_row(+ &mut self,+ layers: &mut TripleLayerQuadAllocator<'_>,+ x: f32,+ y: f32,+ width: f32,+ description: &str,+ draw_top_rule: bool,+ ) -> anyhow::Result<()> {+ let palette = self.palette();+ let ui_font = Rc::clone(&self.ui_font);+ if draw_top_rule {+ self.paint_separator(layers, x, y - 28.0, width)?;+ }++ let (control_x, control_y, control_width) = self.dropdown_control_geometry(x, y, width);+ let text_width = (control_x - x - 24.0).max(width * 0.45);+ let action = SettingsAction::ToggleAppIconMenu;+ let control_rect = rect(control_x, control_y, control_width, CONTROL_HEIGHT);+ let open = self.ui.open_dropdown == Some(SettingsDropdown::AppIcon);+ 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);+ self.draw_text(layers, &ui_font, x, y, "App Icon", palette.text, text_width)?;+ self.draw_text(+ layers,+ &ui_font,+ x,+ self.settings_row_description_y(y),+ description,+ palette.secondary_text,+ text_width,+ )?;+ self.draw_rounded_frame(+ layers,+ 0,+ control_rect.origin.x,+ control_rect.origin.y,+ control_rect.size.width,+ control_rect.size.height,+ bg,+ border,+ CONTROL_RADIUS,+ )?;+ self.draw_text(+ layers,+ &ui_font,+ control_x + 16.0,+ self.control_text_y(control_y, CONTROL_HEIGHT),+ self.native_settings.appearance.app_icon.label(),+ palette.text,+ control_width - 60.0,+ )?;+ self.draw_svg_icon(+ layers,+ SvgIcon::ChevronDown,+ control_x + control_width - 38.0,+ control_y + (CONTROL_HEIGHT - 22.0) / 2.0,+ 22.0,+ palette.secondary_text,+ )?;++ Ok(())+ }+fn theme_mode_control_geometry(&self, x: f32, y: f32, width: f32) -> (f32, f32, f32) {+ self.dropdown_control_geometry(x, y, width)+ }++ fn dropdown_control_geometry(&self, x: f32, y: f32, width: f32) -> (f32, f32, f32) {let control_width = if width >= 680.0 {280.0_f32.min(width * 0.36)} else {@@ -3583,21 +4168,23 @@ impl SettingsWindow {x: f32,max_width: f32,) -> anyhow::Result<()> {- if self.ui.open_dropdown != Some(SettingsDropdown::ThemeMode) {+ let Some(dropdown) = self.ui.open_dropdown else {return Ok(());- }+ };let scroll = self.ui.content_scroll.offset;let card_padding = 36.0;let section_y = CONTENT_SECTION_Y - scroll;- let (_, first_row_y) = self.settings_card_geometry(section_y, 3);+ let (_, first_row_y) = self.settings_card_geometry(section_y, 4);let (row_x, row_y, row_width) = match self.selected {- SettingsSection::Appearance => (- x + card_padding,- first_row_y,- max_width - card_padding * 2.0,- ),- SettingsSection::General => (+ SettingsSection::Appearance => {+ let row_y = match dropdown {+ SettingsDropdown::ThemeMode => first_row_y,+ SettingsDropdown::AppIcon => first_row_y + self.settings_row_step(),+ };+ (x + card_padding, row_y, max_width - card_padding * 2.0)+ }+ SettingsSection::General if dropdown == SettingsDropdown::ThemeMode => (x + card_padding,first_row_y + self.settings_row_step() * 2.0,max_width - card_padding * 2.0,@@ -3605,13 +4192,21 @@ impl SettingsWindow {_ => return Ok(()),};let (control_x, control_y, control_width) =- self.theme_mode_control_geometry(row_x, row_y, row_width);- self.paint_theme_mode_menu(- layers,- control_x,- control_y + CONTROL_HEIGHT + 8.0,- control_width,- )+ self.dropdown_control_geometry(row_x, row_y, row_width);+ match dropdown {+ SettingsDropdown::ThemeMode => self.paint_theme_mode_menu(+ layers,+ control_x,+ control_y + CONTROL_HEIGHT + 8.0,+ control_width,+ ),+ SettingsDropdown::AppIcon => self.paint_app_icon_menu(+ layers,+ control_x,+ control_y + CONTROL_HEIGHT + 8.0,+ control_width,+ ),+ }}fn paint_theme_mode_menu(@@ -3621,15 +4216,64 @@ impl SettingsWindow {y: f32,width: f32,) -> anyhow::Result<()> {- let palette = self.palette();- let ui_font = Rc::clone(&self.ui_font);let options = [- NativeThemeMode::System,- NativeThemeMode::Light,- NativeThemeMode::Dark,+ (+ NativeThemeMode::System.label(),+ SettingsAction::SetThemeMode(NativeThemeMode::System),+ self.native_settings.appearance.theme_mode == NativeThemeMode::System,+ ),+ (+ NativeThemeMode::Light.label(),+ SettingsAction::SetThemeMode(NativeThemeMode::Light),+ self.native_settings.appearance.theme_mode == NativeThemeMode::Light,+ ),+ (+ NativeThemeMode::Dark.label(),+ SettingsAction::SetThemeMode(NativeThemeMode::Dark),+ self.native_settings.appearance.theme_mode == NativeThemeMode::Dark,+ ),+ ];+ self.paint_dropdown_menu(layers, x, y, width, &options)+ }++ fn paint_app_icon_menu(+ &mut self,+ layers: &mut TripleLayerQuadAllocator<'_>,+ x: f32,+ y: f32,+ width: f32,+ ) -> anyhow::Result<()> {+ let options = [+ (+ NativeAppIcon::Default.label(),+ SettingsAction::SetAppIcon(NativeAppIcon::Default),+ self.native_settings.appearance.app_icon == NativeAppIcon::Default,+ ),+ (+ NativeAppIcon::Simple.label(),+ SettingsAction::SetAppIcon(NativeAppIcon::Simple),+ self.native_settings.appearance.app_icon == NativeAppIcon::Simple,+ ),];+ self.paint_dropdown_menu(layers, x, y, width, &options)+ }++ fn paint_dropdown_menu(+ &mut self,+ layers: &mut TripleLayerQuadAllocator<'_>,+ x: f32,+ y: f32,+ width: f32,+ options: &[(&'static str, SettingsAction, bool)],+ ) -> anyhow::Result<()> {+ let palette = self.palette();+ let ui_font = Rc::clone(&self.ui_font);let row_height = 46.0;- let menu_height = row_height * options.len() as f32 + 12.0;+ let row_gap = 6.0;+ let menu_padding = 8.0;+ let menu_height = menu_padding * 2.0+ + row_height * options.len() as f32+ + row_gap * options.len().saturating_sub(1) as f32;let menu_bg = match self.effective_appearance() {Appearance::Light | Appearance::LightHighContrast => rgba(248, 248, 250, 1.0),Appearance::Dark | Appearance::DarkHighContrast => rgba(34, 34, 36, 1.0),@@ -3647,12 +4291,10 @@ impl SettingsWindow {CONTROL_RADIUS,)?;- let mut row_y = y + 6.0;- for mode in options {- let action = SettingsAction::SetThemeMode(mode);- let row_rect = rect(x + 6.0, row_y, width - 12.0, row_height);+ let mut row_y = y + menu_padding;+ for (label, action, selected) in options.iter().copied() {+ let row_rect = rect(x + 8.0, row_y, width - 16.0, row_height);self.ui_context.push(row_rect, WidgetKind::Button, action);- let selected = self.native_settings.appearance.theme_mode == mode;let hovered = self.ui.interaction.hovered == Some(action);let pressed = self.ui.interaction.pressed == Some(action);let row_bg = if selected {@@ -3681,7 +4323,7 @@ impl SettingsWindow {&ui_font,row_rect.origin.x + 14.0,self.control_text_y(row_rect.origin.y, row_height),- mode.label(),+ label,if selected {palette.selected_text} else {@@ -3689,7 +4331,7 @@ impl SettingsWindow {},row_rect.size.width - 28.0,)?;- row_y += row_height;+ row_y += row_height + row_gap;}Ok(())diff --git a/wezterm-gui/src/termwindow/keyevent.rs b/wezterm-gui/src/termwindow/keyevent.rsindex d51c9d33..ed953228 100644--- a/wezterm-gui/src/termwindow/keyevent.rs+++ b/wezterm-gui/src/termwindow/keyevent.rs@@ -796,6 +796,16 @@ impl super::TermWindow {}let modifiers = window_key.modifiers;+ let key = self.win_key_code_to_termwiz_key_code(&window_key.key);+ let should_acknowledge_session_work = window_key.key_is_down+ && match &key {+ Key::Code(key) => !key.is_modifier(),+ Key::Composed(_) => true,+ Key::None => false,+ };+ if should_acknowledge_session_work && self.acknowledge_active_workspace_session_work() {+ context.invalidate();+ }if self.process_key(&pane,@@ -818,8 +828,6 @@ impl super::TermWindow {self.key_table_state.pop_until_unknown();}- let key = self.win_key_code_to_termwiz_key_code(&window_key.key);-match key {Key::Code(key) => {if window_key.key_is_down && !key.is_modifier() {diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rsindex a13d9337..01769db4 100644--- a/wezterm-gui/src/termwindow/mod.rs+++ b/wezterm-gui/src/termwindow/mod.rs@@ -47,8 +47,8 @@ use mux::pane::{};use mux::renderable::RenderableDimensions;use mux::tab::{- PaneStackId, PositionedPane, PositionedSplit, SplitDirection, SplitRequest,- SplitSize as MuxSplitSize, Tab, TabId,+ CollapsedPaneLayout, PaneStackId, PositionedPane, PositionedSplit, SplitDirection,+ SplitRequest, SplitSize as MuxSplitSize, Tab, TabId,};use mux::window::WindowId as MuxWindowId;use mux::{Mux, MuxNotification};@@ -71,6 +71,16 @@ use wezterm_term::color::{ColorAttribute, ColorPalette};use wezterm_term::input::LastMouseClick;use wezterm_term::{Alert, Progress, StableRowIndex, TerminalConfiguration, TerminalSize};+fn gpu_debug_enabled() -> bool {+ std::env::var_os("THINKTERM_GPU_DEBUG").is_some()+}++fn gpu_debug(message: impl AsRef<str>) {+ if gpu_debug_enabled() {+ log::info!("[gpu-resource] {}", message.as_ref());+ }+}+pub mod background;pub mod box_model;pub mod charselect;@@ -220,6 +230,7 @@ pub enum UIItemType {WorkspaceSidebarResize,WorkspaceSidebarSettings,WorkspaceSidebarViewOptions,+ WorkspaceSidebarNotifications,AboveScrollThumb,ScrollThumb,BelowScrollThumb,@@ -232,6 +243,8 @@ pub enum PaneNavAction {Activate(PaneId),Close(PaneId),NewTab,+ ToggleZoom,+ ToggleCollapse,SplitRight,SplitDown,}@@ -647,6 +660,7 @@ pub struct TermWindow {tab_bar_scroll_target: f32,pane_nav_tab_scroll_offsets: HashMap<PaneId, f32>,pane_nav_tab_scroll_targets: HashMap<PaneId, f32>,+ collapsed_pane_layouts: HashMap<PaneStackId, CollapsedPaneLayout>,tab_wheel_surface_lock: Option<(TabWheelSurface, Instant)>,tab_wheel_direction_lock: Option<(TabWheelSurface, i16, Instant)>,inline_tab_rename: Option<InlineTabRename>,@@ -731,6 +745,62 @@ pub struct TermWindow {}impl TermWindow {+ pub(crate) fn memory_resource_lines(&self, label: &str) -> Vec<String> {+ let backend = if self.webgpu.is_some() {+ "WebGpu"+ } else if self.gl.is_some() {+ "OpenGL"+ } else {+ "none"+ };+ let tab_count = Mux::get()+ .get_window(self.mux_window_id)+ .map(|window| window.len())+ .unwrap_or(0);+ let mut lines = vec![format!(+ "{label}: backend={backend} size={}x{} dpi={} panes={} tabs={}",+ self.dimensions.pixel_width,+ self.dimensions.pixel_height,+ self.dimensions.dpi,+ self.get_panes_to_render().len(),+ tab_count+ )];++ if let Some(render_state) = self.render_state.as_ref() {+ let stats = render_state.stats();+ lines.push(format!(+ "{label}: render_backend={} atlas={} glyphs={} svg_icons={} rotated_icons={} images={} frames={} blocks={} colors={} cursor_glyphs={}",+ stats.backend,+ stats.atlas_size,+ stats.glyphs,+ stats.svg_icons,+ stats.rotated_svg_icons,+ stats.decoded_images,+ stats.image_frames,+ stats.block_glyphs,+ stats.color_sprites,+ stats.cursor_glyphs,+ ));+ lines.push(format!(+ "{label}: layers={} vertex_buffers={} quad_capacity={} line_glyphs={}",+ stats.layers, stats.vertex_buffers, stats.layer_quads, stats.line_glyphs+ ));+ } else {+ lines.push(format!("{label}: render_state=none"));+ }++ lines.push(format!(+ "{label}: caches shape={} line_state={} line_quad={} line_to_element_shape={} pane_font={} semantic_zones={}",+ self.shape_cache.borrow().len(),+ self.line_state_cache.borrow().len(),+ self.line_quad_cache.borrow().len(),+ self.line_to_ele_shape_cache.borrow().len(),+ self.pane_font_cache.borrow().len(),+ self.semantic_zones.len(),+ ));+ lines+ }+fn load_os_parameters(&mut self) {if let Some(ref window) = self.window {self.os_parameters = match window.get_os_parameters(&self.config, self.window_state) {@@ -985,6 +1055,7 @@ impl TermWindow {tab_bar_scroll_target: 0.0,pane_nav_tab_scroll_offsets: HashMap::new(),pane_nav_tab_scroll_targets: HashMap::new(),+ collapsed_pane_layouts: HashMap::new(),tab_wheel_surface_lock: None,tab_wheel_direction_lock: None,inline_tab_rename: None,@@ -1138,15 +1209,27 @@ impl TermWindow {let gl = match config.front_end {FrontEndSelection::WebGpu => None,- _ => Some(window.enable_opengl().await?),+ _ => {+ gpu_debug(format!(+ "enable OpenGL main_window size={}x{} dpi={}",+ dimensions.pixel_width, dimensions.pixel_height, dimensions.dpi+ ));+ Some(window.enable_opengl().await?)+ }};{let mut myself = tw.borrow_mut();let webgpu = match config.front_end {- FrontEndSelection::WebGpu => Some(Rc::new(- WebGpuState::new(&window, dimensions, &config).await?,- )),+ FrontEndSelection::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?,+ ))+ }_ => None,};myself.config_subscription.replace(config_subscription);@@ -1704,7 +1787,9 @@ impl TermWindow {fn apply_icon(window: &Window) -> anyhow::Result<()> {#[cfg(target_os = "macos")]- if let Some(path) = Self::macos_application_icon_path() {+ if let Some(path) = crate::native_settings::app_icon_path(+ crate::native_settings::load().appearance.app_icon,+ ) {match ::window::set_application_icon_from_file(&path) {Ok(()) => return Ok(()),Err(err) => log::warn!(@@ -1725,23 +1810,6 @@ impl TermWindow {Ok(())}- #[cfg(target_os = "macos")]- fn macos_application_icon_path() -> Option<PathBuf> {- let exe = std::env::current_exe().ok()?;- let exe_dir = exe.parent()?;- let mut candidates = vec![exe_dir.join("ThinkTerm.icns")];-- if let Some(contents_dir) = exe_dir.parent() {- candidates.push(contents_dir.join("Resources").join("ThinkTerm.icns"));- }-- if let Some(repo_dir) = PathBuf::from(env!("CARGO_MANIFEST_DIR")).parent() {- candidates.push(repo_dir.join("assets").join("icon").join("ThinkTerm.icns"));- }-- candidates.into_iter().find(|path| path.exists())- }-fn schedule_status_update(&self) {if let Some(window) = self.window.as_ref() {window.notify(TermWindowNotif::EmitStatusUpdate);@@ -3185,6 +3253,7 @@ impl TermWindow {}SplitHorizontal(spawn) => {log::trace!("SplitHorizontal {:?}", spawn);+ self.restore_collapsed_panes_for_active_tab();self.spawn_command(spawn,SpawnWhere::SplitPane(SplitRequest {@@ -3197,6 +3266,7 @@ impl TermWindow {}SplitVertical(spawn) => {log::trace!("SplitVertical {:?}", spawn);+ self.restore_collapsed_panes_for_active_tab();self.spawn_command(spawn,SpawnWhere::SplitPane(SplitRequest {@@ -3719,6 +3789,7 @@ impl TermWindow {}SplitPane(split) => {log::trace!("SplitPane {:?}", split);+ self.restore_collapsed_panes_for_active_tab();self.spawn_command(&split.command,SpawnWhere::SplitPane(SplitRequest {@@ -3778,6 +3849,62 @@ impl TermWindow {Ok(PerformAssignmentResult::Handled)}+ fn restore_collapsed_panes_for_active_tab(&mut self) {+ if self.collapsed_pane_layouts.is_empty() {+ return;+ }++ let Some(tab) = Mux::get().get_active_tab_for_window(self.mux_window_id) else {+ self.collapsed_pane_layouts.clear();+ return;+ };++ let layouts: Vec<_> = self+ .collapsed_pane_layouts+ .drain()+ .map(|(_, layout)| layout)+ .collect();+ for layout in layouts {+ if !tab.restore_collapsed_pane(layout) {+ self.collapsed_pane_layouts+ .insert(layout.pane_stack_id, layout);+ }+ }+ }++ pub(crate) fn reapply_collapsed_panes_for_window(&mut self) {+ if self.collapsed_pane_layouts.is_empty() {+ return;+ }++ let mux = Mux::get();+ let Some(window) = mux.get_window(self.mux_window_id) else {+ self.collapsed_pane_layouts.clear();+ return;+ };++ let min_cells = self.collapsed_pane_min_cells();+ let layouts: Vec<_> = self.collapsed_pane_layouts.values().copied().collect();+ for layout in layouts {+ let mut found_stack = false;+ for tab in window.iter() {+ let contains_stack = tab+ .iter_panes_ignoring_zoom()+ .into_iter()+ .any(|pane| pane.pane_stack_id == layout.pane_stack_id);+ if contains_stack {+ found_stack = true;+ tab.reapply_collapsed_pane(layout, min_cells);+ break;+ }+ }++ if !found_stack {+ self.collapsed_pane_layouts.remove(&layout.pane_stack_id);+ }+ }+ }+fn do_open_link_at_mouse_cursor(&self, pane: &Arc<dyn Pane>) {// They clicked on a link, so let's open it!// We need to ensure that we spawn the `open` call outside of the context@@ -4282,6 +4409,19 @@ impl TermWindow {impl Drop for TermWindow {fn drop(&mut self) {+ gpu_debug(format!(+ "drop main_window backend={} size={}x{} dpi={}",+ if self.webgpu.is_some() {+ "WebGpu"+ } else if self.gl.is_some() {+ "OpenGL"+ } else {+ "none"+ },+ self.dimensions.pixel_width,+ self.dimensions.pixel_height,+ self.dimensions.dpi+ ));self.clear_all_overlays();if let Some(window) = self.window.take() {if let Some(fe) = try_front_end() {diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rsindex 6ef6344e..90b92d50 100644--- a/wezterm-gui/src/termwindow/mouseevent.rs+++ b/wezterm-gui/src/termwindow/mouseevent.rs@@ -40,6 +40,13 @@ const TAB_WHEEL_SURFACE_LOCK_MS: u64 = 700;const TAB_WHEEL_DIRECTION_LOCK_MS: u64 = 140;impl super::TermWindow {+ pub(crate) fn collapsed_pane_min_cells(&self) -> usize {+ let nav_height = pane_nav_bar_height_for_metrics(self.render_metrics);+ let cell_height = self.render_metrics.cell_size.height.max(1) as usize;++ nav_height.div_ceil(cell_height).max(2)+ }+fn tab_scroll_pixels(amount: i16) -> f32 {let steps = amount.unsigned_abs().max(1) as f32;let delta = (steps * 56.0).min(280.0);@@ -577,6 +584,7 @@ impl super::TermWindow {| UIItemType::WorkspaceSidebarResize| UIItemType::WorkspaceSidebarSettings| UIItemType::WorkspaceSidebarViewOptions+ | UIItemType::WorkspaceSidebarNotifications| UIItemType::AboveScrollThumb| UIItemType::BelowScrollThumb| UIItemType::ScrollThumb@@ -603,6 +611,7 @@ impl super::TermWindow {| UIItemType::WorkspaceSidebarResize| UIItemType::WorkspaceSidebarSettings| UIItemType::WorkspaceSidebarViewOptions+ | UIItemType::WorkspaceSidebarNotifications| UIItemType::AboveScrollThumb| UIItemType::BelowScrollThumb| UIItemType::ScrollThumb@@ -1120,6 +1129,9 @@ impl super::TermWindow {UIItemType::WorkspaceSidebarViewOptions => {self.mouse_event_workspace_sidebar_view_options(item, event, context);}+ UIItemType::WorkspaceSidebarNotifications => {+ context.set_cursor(Some(MouseCursor::Hand));+ }}}@@ -1561,6 +1573,13 @@ impl super::TermWindow {match action {PaneNavAction::Background => {if let Some(tab) = mux.get_active_tab_for_window(self.mux_window_id) {+ if tab+ .pane_stack_id(pane_id)+ .is_some_and(|stack_id| self.collapsed_pane_layouts.contains_key(&stack_id))+ {+ context.invalidate();+ return;+ }tab.set_active_idx(pane_index);}if self.last_mouse_click.as_ref().map(|c| c.streak) == Some(2) {@@ -1568,11 +1587,29 @@ impl super::TermWindow {}}PaneNavAction::Activate(target_pane_id) => {+ if let Some(tab) = mux.get_active_tab_for_window(self.mux_window_id) {+ if let Some(stack_id) = tab.pane_stack_id(target_pane_id) {+ if let Some(layout) = self.collapsed_pane_layouts.remove(&stack_id) {+ if !tab.restore_collapsed_pane(layout) {+ self.collapsed_pane_layouts.insert(stack_id, layout);+ context.invalidate();+ return;+ }+ }+ }+ }if let Err(err) = mux.activate_pane_in_stack(target_pane_id) {log::error!("pane nav activate failed: {err:#}");}}PaneNavAction::Close(target_pane_id) => {+ if let Some(tab) = mux.get_active_tab_for_window(self.mux_window_id) {+ if tab.pane_stack_tabs(target_pane_id).len() <= 1 {+ if let Some(stack_id) = tab.pane_stack_id(target_pane_id) {+ self.collapsed_pane_layouts.remove(&stack_id);+ }+ }+ }if let Some(pane) = mux.get_pane(target_pane_id) {self.close_pane(pane, true);}@@ -1583,8 +1620,70 @@ impl super::TermWindow {}self.spawn_pane_nav_tab(pane_id, pane_index);}+ PaneNavAction::ToggleZoom => {+ if let Some(tab) = mux.get_active_tab_for_window(self.mux_window_id) {+ tab.set_active_idx(pane_index);+ tab.toggle_zoom();+ }+ }+ PaneNavAction::ToggleCollapse => {+ if let Some(tab) = mux.get_active_tab_for_window(self.mux_window_id) {+ let Some(stack_id) = tab.pane_stack_id(pane_id) else {+ context.invalidate();+ return;+ };+ if let Some(layout) = self.collapsed_pane_layouts.remove(&stack_id) {+ if !tab.restore_collapsed_pane(layout) {+ self.collapsed_pane_layouts.insert(stack_id, layout);+ context.invalidate();+ return;+ }+ tab.set_active_idx(pane_index);+ } else {+ tab.set_active_idx(pane_index);+ let can_collapse_direction = tab.pane_split_direction_by_index(pane_index)+ == Some(SplitDirection::Vertical);+ if can_collapse_direction {+ let panes = tab.iter_panes_ignoring_zoom();+ let has_collapsed_stack = panes.iter().any(|pane| {+ self.collapsed_pane_layouts+ .contains_key(&pane.pane_stack_id)+ });+ let has_another_visible_stack =+ panes.into_iter().any(|pane| pane.pane_stack_id != stack_id);+ if !has_collapsed_stack && has_another_visible_stack {+ if let Some(layout) = tab.collapse_pane_by_index(+ pane_index,+ self.collapsed_pane_min_cells(),+ ) {+ let collapsed_stack_id = layout.pane_stack_id;+ self.collapsed_pane_layouts+ .insert(collapsed_stack_id, layout);+ if let Some(visible_pane) =+ tab.iter_panes_ignoring_zoom().into_iter().find(|pane| {+ pane.pane_stack_id != collapsed_stack_id+ && !self+ .collapsed_pane_layouts+ .contains_key(&pane.pane_stack_id)+ })+ {+ tab.set_active_idx(visible_pane.index);+ }+ }+ }+ }+ }+ }+ }PaneNavAction::SplitRight | PaneNavAction::SplitDown => {if let Some(tab) = mux.get_active_tab_for_window(self.mux_window_id) {+ if tab+ .pane_stack_id(pane_id)+ .is_some_and(|stack_id| self.collapsed_pane_layouts.contains_key(&stack_id))+ {+ context.invalidate();+ return;+ }tab.set_active_idx(pane_index);}let pane = match mux.get_pane(pane_id) {@@ -1617,6 +1716,12 @@ impl super::TermWindow {Some(tab) => tab,None => return,};+ if tab+ .pane_stack_id(pane_id)+ .is_some_and(|stack_id| self.collapsed_pane_layouts.contains_key(&stack_id))+ {+ return;+ }let panes = tab.iter_panes_ignoring_zoom();let pos = panes.iter()@@ -2154,6 +2259,11 @@ impl super::TermWindow {false};+ if matches!(event.kind, WMEK::Press(_)) && self.acknowledge_active_workspace_session_work()+ {+ context.invalidate();+ }+if self.focused.is_some() && !is_focused {if matches!(&event.kind, WMEK::Press(_))&& self.config.swallow_mouse_click_on_window_focusdiff --git a/wezterm-gui/src/termwindow/render/draw.rs b/wezterm-gui/src/termwindow/render/draw.rsindex 4c622260..309c54bd 100644--- a/wezterm-gui/src/termwindow/render/draw.rs+++ b/wezterm-gui/src/termwindow/render/draw.rs@@ -1,5 +1,5 @@use crate::colorease::ColorEaseUniform;-use crate::renderstate::RenderState;+use crate::renderstate::{LoggedSrgbTexture2d, RenderState};use crate::termwindow::webgpu::{ShaderUniform, WebGpuState, WebGpuTexture};use crate::termwindow::RenderFrame;use crate::uniforms::UniformBuilder;@@ -180,7 +180,13 @@ impl crate::TermWindow {let gl_state = self.render_state.as_ref().unwrap();let tex = gl_state.glyph_cache.borrow().atlas.texture();- let tex = tex.downcast_ref::<SrgbTexture2d>().unwrap();+ let tex = if let Some(tex) = tex.downcast_ref::<SrgbTexture2d>() {+ tex+ } else {+ tex.downcast_ref::<LoggedSrgbTexture2d>()+ .expect("OpenGL texture atlas")+ .inner()+ };frame.clear_color(0., 0., 0., 0.);diff --git a/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs b/wezterm-gui/src/termwindow/render/fancy_tab_bar.rsindex f8c760c2..3b4f42a1 100644--- a/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs+++ b/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs@@ -6,9 +6,9 @@ use crate::termwindow::ui::tokens::{CAPSULE_BORDER_WIDTH, SIDEBAR_INSET, TAB_CLOSE_HOVER_INSET, TAB_CLOSE_HOVER_RADIUS,TAB_CLOSE_RIGHT_GAP, TAB_ROW_START_PADDING, TAB_VERTICAL_PADDING,WINDOW_TAB_ACTION_RESERVED_WIDTH, WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_SIZE,- WINDOW_TAB_FULLSCREEN_SIDEBAR_ICON_SIZE, WINDOW_TAB_GAP, WINDOW_TAB_LEADING_ACTION_BUTTON_SIZE,- WINDOW_TAB_LEADING_ACTION_GAP, WINDOW_TAB_LEADING_ACTION_ICON_SIZE, WINDOW_TAB_RADIUS,- WINDOW_TAB_TOP_SPACER,+ WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_Y_OFFSET, WINDOW_TAB_FULLSCREEN_SIDEBAR_ICON_SIZE,+ WINDOW_TAB_GAP, WINDOW_TAB_LEADING_ACTION_BUTTON_SIZE, WINDOW_TAB_LEADING_ACTION_GAP,+ WINDOW_TAB_LEADING_ACTION_ICON_SIZE, WINDOW_TAB_RADIUS, WINDOW_TAB_TOP_SPACER,};use crate::termwindow::{TermWindowNotif, UIItem, UIItemType};use crate::ui::UiPalette;@@ -237,14 +237,20 @@ impl crate::TermWindow {} else {WINDOW_TAB_LEADING_ACTION_ICON_SIZE};- let button_size = action_button_size.min(row_height.saturating_sub(4)).max(1);+ let button_size = if is_sidebar_toggle {+ action_button_size+ } else {+ action_button_size.min(row_height.saturating_sub(4)).max(1)+ };let icon_size = action_icon_size.min(button_size.saturating_sub(2));if is_sidebar_toggle {let button_y = if self.config.tab_bar_at_bottom {row_y + (row_height.saturating_sub(button_size) / 2)} else {- row_y.saturating_sub(WINDOW_TAB_TOP_SPACER) + SIDEBAR_INSET+ row_y.saturating_sub(WINDOW_TAB_TOP_SPACER)+ + SIDEBAR_INSET+ + WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_Y_OFFSET};self.paint_window_sidebar_toggle_button(layers,@@ -298,7 +304,7 @@ impl crate::TermWindow {0.12},),- 6.0,+ SIDEBAR_INSET as f32,).context("window sidebar toggle hover")?;}diff --git a/wezterm-gui/src/termwindow/render/pane.rs b/wezterm-gui/src/termwindow/render/pane.rsindex 99ebf8e0..101834c4 100644--- a/wezterm-gui/src/termwindow/render/pane.rs+++ b/wezterm-gui/src/termwindow/render/pane.rs@@ -9,6 +9,7 @@ use crate::termwindow::render::{};use crate::termwindow::ui::icons::SvgIcon;use crate::termwindow::ui::pane_nav_bar_height_for_metrics;+use crate::termwindow::ui::status_icon::{split_leading_legacy_progress_marker, UiStatusKind};use crate::termwindow::ui::tokens::{CAPSULE_BORDER_WIDTH, PANE_NAV_BUTTON_GAP, PANE_NAV_ICON_GAP, PANE_NAV_INSET, PANE_NAV_TAB_GAP,PANE_NAV_TAB_RADIUS, PANE_NAV_TAB_TOP_OFFSET, TAB_CLOSE_HOVER_INSET, TAB_CLOSE_HOVER_RADIUS,@@ -18,12 +19,12 @@ use crate::termwindow::{PaneNavAction, ScrollHit, UIItem, UIItemType};use crate::ui::UiPalette;use crate::utilsprites::RenderMetrics;use ::window::bitmaps::TextureRect;-use ::window::DeadKeyStatus;+use ::window::{DeadKeyStatus, RectF};use anyhow::Context;use config::VisualBellTarget;use mux::pane::{PaneId, WithPaneLines};use mux::renderable::{RenderableDimensions, StableCursorPosition};-use mux::tab::PositionedPane;+use mux::tab::{CollapsedPaneLayout, PositionedPane, SplitDirection};use mux::Mux;use ordered_float::NotNan;use std::rc::Rc;@@ -67,12 +68,423 @@ impl crate::TermWindow {))}+ fn pane_frame_rect(&self, pos: &PositionedPane) -> anyhow::Result<RectF> {+ let (content_pane_x, pane_y) = self.pane_content_origin(pos)?;+ let content_pane_width = pos.width as f32 * self.render_metrics.cell_size.width as f32;+ let content_pane_right = content_pane_x + content_pane_width;+ let pane_x = if pos.left == 0 && self.workspace_sidebar_width() > 0 {+ self.tab_bar_left_edge() as f32+ } else {+ content_pane_x+ };+ let mut height = (pos.height as f32 * self.render_metrics.cell_size.height as f32).max(1.0);+ if self.collapsed_pane_layouts.contains_key(&pos.pane_stack_id) && pos.top > 0 {+ height = height.max(pane_nav_bar_height_for_metrics(self.render_metrics) as f32);+ }++ Ok(euclid::rect(+ pane_x,+ pane_y,+ (content_pane_right - pane_x).max(1.0),+ height,+ ))+ }++ fn paint_collapsed_pane_nav_bar(+ &mut self,+ pos: &PositionedPane,+ layers: &mut TripleLayerQuadAllocator,+ layout: CollapsedPaneLayout,+ ) -> anyhow::Result<usize> {+ let pane_rect = self.pane_frame_rect(pos)?;+ let chrome = UiPalette::for_appearance(crate::native_settings::effective_appearance());+ let foreground = chrome.text;+ let muted_fg = chrome.secondary_text;++ self.filled_rectangle(layers, 0, pane_rect, chrome.sidebar_bg)+ .context("collapsed pane background")?;++ self.ui_items.push(UIItem {+ x: pane_rect.origin.x.max(0.0) as usize,+ y: pane_rect.origin.y.max(0.0) as usize,+ width: pane_rect.size.width.max(0.0) as usize,+ height: pane_rect.size.height.max(0.0) as usize,+ item_type: UIItemType::PaneNav {+ pane_id: pos.pane.pane_id(),+ pane_index: pos.index,+ action: PaneNavAction::Background,+ },+ });++ const COLLAPSED_EDGE_PADDING: usize = 8;+ const COLLAPSED_BUTTON_GAP: usize = 6;+ const COLLAPSED_SECTION_GAP: usize = 10;++ let tabs = Mux::get().pane_stack_tabs(pos.pane.pane_id());+ let active_tab = tabs.iter().find(|tab| tab.is_active);++ let is_vertical_strip = layout.split_direction == SplitDirection::Horizontal;+ if is_vertical_strip {+ let strip_left = pane_rect.origin.x.max(0.0) as usize;+ let strip_top = pane_rect.origin.y.max(0.0) as usize;+ let strip_width = pane_rect.size.width.max(0.0) as usize;+ let strip_bottom = pane_rect.max_y().max(0.0) as usize;+ let button_size = (pane_rect.size.width as usize)+ .saturating_sub(COLLAPSED_EDGE_PADDING * 2)+ .clamp(24, 30);+ let icon_size = button_size.saturating_sub(8).clamp(16, 22);+ let x = strip_left + (strip_width.saturating_sub(button_size) / 2);+ let mut y = strip_top + COLLAPSED_EDGE_PADDING;++ if let Some(tab) = &active_tab {+ if y.saturating_add(button_size) <= strip_bottom {+ self.fill_rounded_rectangle_with_border(+ layers,+ 1,+ euclid::rect(x as f32, y as f32, button_size as f32, button_size as f32),+ chrome.control_bg,+ chrome.control_border,+ PANE_NAV_TAB_RADIUS,+ CAPSULE_BORDER_WIDTH,+ )+ .context("collapsed vertical pane tab chip")?;+ self.ui_items.push(UIItem {+ x,+ y,+ width: button_size,+ height: button_size,+ item_type: UIItemType::PaneNav {+ pane_id: pos.pane.pane_id(),+ pane_index: pos.index,+ action: PaneNavAction::Activate(tab.pane_id),+ },+ });+ self.paint_pane_nav_icon(+ layers,+ SvgIcon::SquareTerminal,+ x + ((button_size.saturating_sub(icon_size)) / 2),+ y + ((button_size.saturating_sub(icon_size)) / 2),+ icon_size,+ foreground,+ )?;+ y = y.saturating_add(button_size + COLLAPSED_SECTION_GAP);+ }+ }++ for (icon, action) in [(SvgIcon::Expand, PaneNavAction::ToggleCollapse)] {+ if y.saturating_add(button_size) > strip_bottom {+ break;+ }+ self.paint_pane_nav_icon_button(+ layers,+ icon,+ x,+ y,+ button_size,+ icon_size,+ muted_fg,+ foreground,+ pos,+ action,+ )?;+ y = y.saturating_add(button_size + COLLAPSED_BUTTON_GAP);+ }+ return Ok(pane_rect.size.height.max(0.0) as usize);+ }++ let strip_left = pane_rect.origin.x.max(0.0) as usize;+ let strip_right = pane_rect.max_x().max(0.0) as usize;+ let strip_height = pane_rect.size.height.max(1.0) as usize;+ let chrome_height = pane_nav_bar_height_for_metrics(self.render_metrics).min(strip_height);+ let icon_size = chrome_height+ .saturating_sub(PANE_NAV_INSET * 2)+ .clamp(20, 24);+ let action_icon_size = icon_size.saturating_add(2).clamp(icon_size, 26);+ let button_size = chrome_height+ .saturating_sub(TAB_VERTICAL_PADDING * 2)+ .max(action_icon_size);+ let button_y =+ pane_rect.origin.y.max(0.0) as usize + (chrome_height.saturating_sub(button_size) / 2);+ let mut button_x = strip_right.saturating_sub(COLLAPSED_EDGE_PADDING);+ let actions = [(SvgIcon::Expand, PaneNavAction::ToggleCollapse)];+ let action_count = actions.len();+ for (idx, (icon, action)) in actions.iter().copied().enumerate() {+ button_x = button_x.saturating_sub(button_size);+ self.paint_pane_nav_icon_button(+ layers,+ icon,+ button_x,+ button_y,+ button_size,+ action_icon_size,+ muted_fg,+ foreground,+ pos,+ action,+ )?;+ if idx + 1 < action_count {+ button_x = button_x.saturating_sub(COLLAPSED_BUTTON_GAP);+ }+ }++ let tab_start = strip_left + COLLAPSED_EDGE_PADDING;+ let tab_width = self.window_tab_width_pixels().ceil() as usize;+ let tab_step = tab_width + PANE_NAV_TAB_GAP;+ let total_tab_width = tabs.len().saturating_mul(tab_width).saturating_add(+ tabs.len()+ .saturating_sub(1)+ .saturating_mul(PANE_NAV_TAB_GAP),+ );+ let max_tab_right = button_x.saturating_sub(COLLAPSED_SECTION_GAP);+ let viewport_width = max_tab_right.saturating_sub(tab_start);+ let max_scroll = total_tab_width.saturating_sub(viewport_width) as f32;+ let scroll_offset = self+ .pane_nav_tab_scroll_offsets+ .get(&pos.pane_stack_id)+ .copied()+ .unwrap_or(0.0)+ .clamp(0.0, max_scroll.max(0.0));+ let suppress_hover = self+ .current_mouse_event+ .as_ref()+ .is_some_and(|event| matches!(event.kind, WMEK::VertWheel(_) | WMEK::HorzWheel(_)))+ || self.tab_wheel_scroll_active();+ let tab_height = button_size;+ let tab_y = button_y;+ let tab_fg = if pos.is_active { foreground } else { muted_fg };+ for (idx, tab) in tabs.into_iter().enumerate() {+ if tab_width <= icon_size + PANE_NAV_ICON_GAP + button_size || viewport_width == 0 {+ break;+ }++ let virtual_x = idx.saturating_mul(tab_step) as f32;+ let tab_left = tab_start as f32 + virtual_x - scroll_offset;+ let tab_right = tab_left + tab_width as f32;+ if tab_right <= tab_start as f32 || tab_left >= max_tab_right as f32 {+ continue;+ }++ let visible_left = tab_left.max(tab_start as f32);+ let visible_right = tab_right.min(max_tab_right as f32);+ let visible_width = (visible_right - visible_left).max(0.0);+ if visible_width <= 1.0 {+ continue;+ }++ let selected_tab = tab.is_active;+ let is_renaming_tab = self.is_renaming_pane_nav_tab(tab.pane_id);+ let this_tab_fg = if selected_tab { tab_fg } else { muted_fg };+ let hover_x = visible_left.max(0.0) as usize;+ let hover_width = visible_width.max(0.0) as usize;+ let is_hovered = !suppress_hover+ && self.is_pointer_over_ui_rect(hover_x, tab_y, hover_width, tab_height);+ let tab_surface_color = if selected_tab {+ chrome.control_bg+ } else if is_hovered && !is_renaming_tab {+ chrome.control_hover_bg+ } else {+ foreground.mul_alpha(0.025)+ };+ let tab_border_color = if selected_tab {+ chrome.control_border+ } else {+ LinearRgba::TRANSPARENT+ };+ self.fill_rounded_rectangle_with_border(+ layers,+ 1,+ euclid::rect(visible_left, tab_y as f32, visible_width, tab_height as f32),+ tab_surface_color,+ tab_border_color,+ PANE_NAV_TAB_RADIUS,+ CAPSULE_BORDER_WIDTH,+ )+ .context("collapsed pane nav tab surface")?;++ self.ui_items.push(UIItem {+ x: visible_left.max(0.0) as usize,+ y: tab_y,+ width: visible_width.max(0.0) as usize,+ height: tab_height,+ item_type: UIItemType::PaneNav {+ pane_id: pos.pane.pane_id(),+ pane_index: pos.index,+ action: PaneNavAction::Activate(tab.pane_id),+ },+ });++ let draw_tab_x = tab_left.max(0.0) as usize;+ let title_icon_x = draw_tab_x + PANE_NAV_INSET;+ let title_icon_y = tab_y + ((tab_height.saturating_sub(icon_size)) / 2);+ let raw_title = self.pane_nav_tab_title(tab.pane_id, &tab.title);+ let (title, status) =+ if let Some(title) = split_leading_legacy_progress_marker(&raw_title) {+ (+ if title.is_empty() { "Terminal" } else { title },+ Some(UiStatusKind::Running),+ )+ } else {+ (raw_title.as_str(), None)+ };+ if title_icon_x >= tab_start && title_icon_x.saturating_add(icon_size) <= max_tab_right+ {+ if let Some(status) = status {+ self.paint_status_icon(+ layers,+ 2,+ status,+ title_icon_x,+ title_icon_y,+ icon_size,+ this_tab_fg,+ )?;+ } else {+ self.paint_pane_nav_icon(+ layers,+ SvgIcon::SquareTerminal,+ title_icon_x,+ title_icon_y,+ icon_size,+ this_tab_fg,+ )?;+ }+ }++ let close_x = draw_tab_x+ .saturating_add(tab_width)+ .saturating_sub(button_size + TAB_CLOSE_RIGHT_GAP);+ let close_slot_reserved = !is_renaming_tab;+ let show_close = close_slot_reserved && (selected_tab || is_hovered);+ if show_close+ && close_x >= tab_start+ && close_x.saturating_add(button_size) <= max_tab_right+ {+ let close_hovered =+ self.is_pointer_over_ui_rect(close_x, tab_y, button_size, button_size);+ if close_hovered {+ let hover_alpha = if self.is_pointer_pressing_ui_rect(+ close_x,+ tab_y,+ button_size,+ button_size,+ ) {+ 0.20+ } else {+ 0.12+ };+ let hover_inset = TAB_CLOSE_HOVER_INSET.min(button_size / 2);+ let hover_size = button_size.saturating_sub(hover_inset * 2);+ self.fill_rounded_rectangle(+ layers,+ 1,+ euclid::rect(+ (close_x + hover_inset) as f32,+ (tab_y + hover_inset) as f32,+ hover_size as f32,+ hover_size as f32,+ ),+ foreground.mul_alpha(hover_alpha),+ TAB_CLOSE_HOVER_RADIUS,+ )+ .context("collapsed pane nav close hover")?;+ }+ self.ui_items.push(UIItem {+ x: close_x,+ y: tab_y,+ width: button_size,+ height: button_size,+ item_type: UIItemType::PaneNav {+ pane_id: pos.pane.pane_id(),+ pane_index: pos.index,+ action: PaneNavAction::Close(tab.pane_id),+ },+ });+ self.paint_pane_nav_icon(+ layers,+ SvgIcon::X,+ close_x + ((button_size.saturating_sub(icon_size)) / 2),+ title_icon_y,+ icon_size,+ if close_hovered { foreground } else { muted_fg },+ )?;+ }++ let ui_font = self+ .fonts+ .title_font_with_size(crate::native_settings::pane_header_font_size())+ .context("collapsed pane nav title font")?;+ let ui_metrics = RenderMetrics::with_font_metrics(&ui_font.metrics());+ let text_x = title_icon_x + icon_size + PANE_NAV_ICON_GAP;+ let text_right = if close_slot_reserved {+ close_x+ } else {+ draw_tab_x + tab_width - PANE_NAV_INSET+ };+ let text_width = text_right+ .min(max_tab_right)+ .saturating_sub(text_x + PANE_NAV_ICON_GAP);+ let text_y =+ tab_y + ((tab_height.saturating_sub(ui_metrics.cell_size.height as usize)) / 2);+ if text_x >= tab_start && text_x < max_tab_right && text_width > 0 {+ let text_fg = if is_renaming_tab {+ self.fill_rounded_rectangle(+ layers,+ 1,+ euclid::rect(+ text_x.saturating_sub(3) as f32,+ text_y as f32,+ text_width.saturating_add(6) as f32,+ ui_metrics.cell_size.height as f32,+ ),+ chrome.selected_bg,+ 4.0,+ )+ .context("collapsed pane nav rename selection")?;+ chrome.selected_text+ } else {+ this_tab_fg+ };+ self.paint_pane_nav_text(+ layers, &ui_font, ui_metrics, title, text_x, text_y, text_width, text_fg,+ )?;+ }+ }++ Ok(strip_height)+ }++ fn can_collapse_pane_stack(&self, pos: &PositionedPane) -> bool {+ let Some(tab) = Mux::get().get_active_tab_for_window(self.mux_window_id) else {+ return false;+ };++ if tab.pane_split_direction_by_index(pos.index) != Some(SplitDirection::Vertical) {+ return false;+ }++ let panes = tab.iter_panes_ignoring_zoom();+ if panes.iter().any(|pane| {+ self.collapsed_pane_layouts+ .contains_key(&pane.pane_stack_id)+ }) {+ return false;+ }++ panes+ .into_iter()+ .any(|pane| pane.pane_stack_id != pos.pane_stack_id)+ }+fn paint_pane_nav_bar(&mut self,pos: &PositionedPane,layers: &mut TripleLayerQuadAllocator,_palette: &ColorPalette,) -> anyhow::Result<usize> {+ if let Some(layout) = self.collapsed_pane_layouts.get(&pos.pane_stack_id).copied() {+ return self.paint_collapsed_pane_nav_bar(pos, layers, layout);+ }+let nav_height = self.pane_nav_bar_height(pos);if nav_height == 0 {return Ok(0);@@ -118,17 +530,30 @@ impl crate::TermWindow {});let icon_size = nav_height.saturating_sub(PANE_NAV_INSET * 2).clamp(20, 24);+ let action_icon_size = icon_size.saturating_add(2).clamp(icon_size, 26);let button_size = nav_height.saturating_sub(TAB_VERTICAL_PADDING * 2)- .max(icon_size);+ .max(action_icon_size);let button_y = pane_y as usize+ (nav_height.saturating_sub(button_size) / 2 + PANE_NAV_TAB_TOP_OFFSET).min(nav_height.saturating_sub(button_size));let mut button_x = (pane_x + pane_width) as usize;- for (icon, action) in [+ let mut actions = vec![(SvgIcon::SplitVertical, PaneNavAction::SplitDown),(SvgIcon::SplitHorizontal, PaneNavAction::SplitRight),- ] {+ ];+ if self.can_collapse_pane_stack(pos) {+ actions.push((SvgIcon::Shrink, PaneNavAction::ToggleCollapse));+ }+ actions.push((+ if pos.is_zoomed {+ SvgIcon::Minimize2+ } else {+ SvgIcon::Maximize2+ },+ PaneNavAction::ToggleZoom,+ ));+ for (icon, action) in actions {button_x = button_x.saturating_sub(button_size + PANE_NAV_BUTTON_GAP);self.paint_pane_nav_icon_button(layers,@@ -136,7 +561,7 @@ impl crate::TermWindow {button_x,button_y,button_size,- icon_size,+ action_icon_size,muted_fg,foreground,pos,@@ -232,16 +657,38 @@ impl crate::TermWindow {let draw_tab_x = tab_left.max(0.0) as usize;let title_icon_x = draw_tab_x + PANE_NAV_INSET;let title_icon_y = tab_y + ((tab_height.saturating_sub(icon_size)) / 2);+ let raw_title = self.pane_nav_tab_title(tab.pane_id, &tab.title);+ let (title, status) =+ if let Some(title) = split_leading_legacy_progress_marker(&raw_title) {+ (+ if title.is_empty() { "Terminal" } else { title },+ Some(UiStatusKind::Running),+ )+ } else {+ (raw_title.as_str(), None)+ };if title_icon_x >= tab_start && title_icon_x.saturating_add(icon_size) <= max_tab_right{- self.paint_pane_nav_icon(- layers,- SvgIcon::SquareTerminal,- title_icon_x,- title_icon_y,- icon_size,- this_tab_fg,- )?;+ if let Some(status) = status {+ self.paint_status_icon(+ layers,+ 2,+ status,+ title_icon_x,+ title_icon_y,+ icon_size,+ this_tab_fg,+ )?;+ } else {+ self.paint_pane_nav_icon(+ layers,+ SvgIcon::SquareTerminal,+ title_icon_x,+ title_icon_y,+ icon_size,+ this_tab_fg,+ )?;+ }}let close_x = draw_tab_x@@ -318,7 +765,6 @@ impl crate::TermWindow {.saturating_sub(text_x + PANE_NAV_ICON_GAP);let text_y =tab_y + ((tab_height.saturating_sub(ui_metrics.cell_size.height as usize)) / 2);- let title = self.pane_nav_tab_title(tab.pane_id, &tab.title);if text_x >= tab_start && text_x < max_tab_right && text_width > 0 {let text_fg = if is_renaming_tab {self.fill_rounded_rectangle(@@ -339,7 +785,7 @@ impl crate::TermWindow {this_tab_fg};self.paint_pane_nav_text(- layers, &ui_font, ui_metrics, &title, text_x, text_y, text_width, text_fg,+ layers, &ui_font, ui_metrics, title, text_x, text_y, text_width, text_fg,)?;}}@@ -674,6 +1120,9 @@ impl crate::TermWindow {let pane_nav_height = self.paint_pane_nav_bar(pos, layers, &palette).context("paint_pane_nav_bar")?;+ if self.collapsed_pane_layouts.contains_key(&pos.pane_stack_id) {+ return Ok(());+ }// TODO: we only have a single scrollbar in a single position.// We only update it for the active pane, but we should probablydiff --git a/wezterm-gui/src/termwindow/resize.rs b/wezterm-gui/src/termwindow/resize.rsindex 2a39c14c..6bb3abeb 100644--- a/wezterm-gui/src/termwindow/resize.rs+++ b/wezterm-gui/src/termwindow/resize.rs@@ -341,6 +341,23 @@ impl super::TermWindow {log::trace!("dimensions didn't change NOP!");return;}+ super::gpu_debug(format!(+ "main_window resize live={} {}x{} -> {}x{} dpi {} -> {} backend={}",+ live_resizing,+ self.dimensions.pixel_width,+ self.dimensions.pixel_height,+ dimensions.pixel_width,+ dimensions.pixel_height,+ self.dimensions.dpi,+ dimensions.dpi,+ if self.webgpu.is_some() {+ "WebGpu"+ } else if self.gl.is_some() {+ "OpenGL"+ } else {+ "none"+ }+ ));let last_state = self.window_state;self.window_state = window_state;self.quad_generation += 1;@@ -470,6 +487,7 @@ impl super::TermWindow {tab.resize(size);}}+ self.reapply_collapsed_panes_for_window();self.sync_pane_font_sizes();} else {log::trace!("terminal size unchanged; skipping mux tab resize");diff --git a/wezterm-gui/src/termwindow/ui/icons.rs b/wezterm-gui/src/termwindow/ui/icons.rsindex 4b03e96c..6035bdb9 100644--- a/wezterm-gui/src/termwindow/ui/icons.rs+++ b/wezterm-gui/src/termwindow/ui/icons.rs@@ -5,9 +5,11 @@ use window::Image;#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]pub enum SvgIcon {Archive,+ Bell,ChevronDown,ChevronRight,Cloud,+ Expand,ExternalLink,Folder,FolderOpen,@@ -17,7 +19,9 @@ pub enum SvgIcon {Keyboard,Loader,LoaderCircle,+ Maximize2,MemoryStick,+ Minimize2,Minus,Palette,PanelLeft,@@ -33,8 +37,10 @@ pub enum SvgIcon {Settings,SlidersHorizontal,SlidersVertical,+ Shrink,CircleAlert,CircleCheck,+ CirclePlus,SquareTerminal,SplitHorizontal,SplitVertical,@@ -47,6 +53,7 @@ impl SvgIcon {pub fn bytes(self) -> &'static [u8] {match self {Self::Archive => include_bytes!("../../../../third_party/lucide/icons/archive.svg"),+ Self::Bell => include_bytes!("../../../../third_party/lucide/icons/bell.svg"),Self::ChevronDown => {include_bytes!("../../../../third_party/lucide/icons/chevron-down.svg")}@@ -54,6 +61,7 @@ impl SvgIcon {include_bytes!("../../../../third_party/lucide/icons/chevron-right.svg")}Self::Cloud => include_bytes!("../../../../third_party/lucide/icons/cloud.svg"),+ Self::Expand => include_bytes!("../../../../third_party/lucide/icons/expand.svg"),Self::ExternalLink => {include_bytes!("../../../../third_party/lucide/icons/external-link.svg")}@@ -71,9 +79,15 @@ impl SvgIcon {Self::LoaderCircle => {include_bytes!("../../../../third_party/lucide/icons/loader-circle.svg")}+ Self::Maximize2 => {+ include_bytes!("../../../../third_party/lucide/icons/maximize-2.svg")+ }Self::MemoryStick => {include_bytes!("../../../../third_party/lucide/icons/memory-stick.svg")}+ Self::Minimize2 => {+ include_bytes!("../../../../third_party/lucide/icons/minimize-2.svg")+ }Self::Minus => include_bytes!("../../../../third_party/lucide/icons/minus.svg"),Self::Palette => include_bytes!("../../../../third_party/lucide/icons/palette.svg"),Self::PanelLeft => {@@ -105,12 +119,16 @@ impl SvgIcon {Self::SlidersVertical => {include_bytes!("../../../../third_party/lucide/icons/sliders-vertical.svg")}+ Self::Shrink => include_bytes!("../../../../third_party/lucide/icons/shrink.svg"),Self::CircleAlert => {include_bytes!("../../../../third_party/lucide/icons/circle-alert.svg")}Self::CircleCheck => {include_bytes!("../../../../third_party/lucide/icons/circle-check.svg")}+ Self::CirclePlus => {+ include_bytes!("../../../../third_party/lucide/icons/circle-plus.svg")+ }Self::SquareTerminal => {include_bytes!("../../../../third_party/lucide/icons/square-terminal.svg")}@@ -143,7 +161,7 @@ impl SvgIcon {let mut transform = resvg::tiny_skia::Transform::from_translate(translate_x, translate_y).pre_scale(scale, scale);if degrees != 0.0 {- transform = transform.pre_rotate_at(degrees, size as f32 / 2.0, size as f32 / 2.0);+ transform = transform.post_rotate_at(degrees, size as f32 / 2.0, size as f32 / 2.0);}let mut pixmap = resvg::tiny_skia::Pixmap::new(size as u32, size as u32)@@ -162,10 +180,12 @@ mod tests {fn svg_icons_rasterize() {for icon in [SvgIcon::Archive,+ SvgIcon::Bell,SvgIcon::ExternalLink,SvgIcon::ChevronDown,SvgIcon::ChevronRight,SvgIcon::Cloud,+ SvgIcon::Expand,SvgIcon::Folder,SvgIcon::FolderOpen,SvgIcon::FolderPlus,@@ -174,7 +194,9 @@ mod tests {SvgIcon::Keyboard,SvgIcon::Loader,SvgIcon::LoaderCircle,+ SvgIcon::Maximize2,SvgIcon::Minus,+ SvgIcon::Minimize2,SvgIcon::Palette,SvgIcon::PanelLeft,SvgIcon::PanelLeftClose,@@ -189,8 +211,10 @@ mod tests {SvgIcon::Settings,SvgIcon::SlidersHorizontal,SvgIcon::SlidersVertical,+ SvgIcon::Shrink,SvgIcon::CircleAlert,SvgIcon::CircleCheck,+ SvgIcon::CirclePlus,SvgIcon::SquareTerminal,SvgIcon::SplitHorizontal,SvgIcon::SplitVertical,diff --git a/wezterm-gui/src/termwindow/ui/sidebar.rs b/wezterm-gui/src/termwindow/ui/sidebar.rsindex e74459e8..5d1992d5 100644--- a/wezterm-gui/src/termwindow/ui/sidebar.rs+++ b/wezterm-gui/src/termwindow/ui/sidebar.rs@@ -6,11 +6,14 @@ use crate::termwindow::render::corners::{TOP_RIGHT_ROUNDED_CORNER,};use crate::termwindow::ui::icons::SvgIcon;+use crate::termwindow::ui::status_icon::{split_leading_legacy_progress_marker, UiStatusKind};use crate::termwindow::ui::tokens::{CAPSULE_BORDER_WIDTH, MACOS_TITLEBAR_CONTENT_TOP_INSET, SIDEBAR_ICON_GAP, SIDEBAR_INSET,SIDEBAR_MAX_WIDTH, SIDEBAR_MIN_WIDTH, SIDEBAR_RESIZE_HANDLE_WIDTH, SIDEBAR_ROW_GAP,- SIDEBAR_ROW_RADIUS, SIDEBAR_WIDTH_CELLS, WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_SIZE,- WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_X, WINDOW_TAB_FULLSCREEN_SIDEBAR_ICON_SIZE,+ SIDEBAR_ROW_RADIUS, SIDEBAR_WIDTH_CELLS, WINDOW_TAB_FULLSCREEN_NEW_SESSION_EXTRA_HEIGHT,+ WINDOW_TAB_FULLSCREEN_NEW_SESSION_Y_OFFSET, WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_SIZE,+ WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_X, WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_Y_OFFSET,+ WINDOW_TAB_FULLSCREEN_SIDEBAR_ICON_SIZE,};use crate::termwindow::{UIItem, UIItemType};use crate::ui::UiPalette;@@ -43,6 +46,11 @@ const SESSION_ACTION_MIN_SIZE: usize = 48;const SESSION_ACTION_MAX_SIZE: usize = 52;const SESSION_ACTION_ICON_INSET: usize = 12;const SESSION_STATUS_DOT_SIZE: usize = 10;+const SESSION_STATUS_ICON_SIZE: usize = 20;+const SESSION_STATUS_ACTIVE_ICON_SIZE: usize = 26;+const SESSION_STATUS_DONE_COLOR: LinearRgba = LinearRgba::with_components(0.20, 0.78, 0.36, 1.0);+const SIDEBAR_SECTION_ACTION_SIZE: usize = 40;+const SIDEBAR_SECTION_ACTION_ICON_INSET: usize = 8;#[derive(Debug, Clone, Copy)]pub struct WorkspaceSidebarRect {@@ -71,7 +79,23 @@ pub fn workspace_sidebar_width_for_metrics(render_metrics: &RenderMetrics) -> us.clamp(SIDEBAR_MIN_WIDTH, SIDEBAR_MAX_WIDTH)}+fn centered_inner_start(origin: usize, outer: usize, inner: usize) -> usize {+ if inner <= outer {+ origin + (outer - inner) / 2+ } else {+ origin.saturating_sub((inner - outer) / 2)+ }+}+impl crate::TermWindow {+ pub(crate) fn acknowledge_active_workspace_session_work(&self) -> bool {+ let mux = Mux::get();+ let Some(window) = mux.get_window(self.mux_window_id) else {+ return false;+ };+ project_sessions::acknowledge_session_work_for_workspace(window.get_workspace())+ }+pub fn workspace_sidebar_width(&self) -> usize {if self.workspace_sidebar_collapsed {0@@ -202,6 +226,140 @@ impl crate::TermWindow {}}+ fn sidebar_session_status_kind(+ &self,+ session: &project_sessions::SessionView,+ ) -> Option<UiStatusKind> {+ let mux = Mux::get();+ let mut is_working = false;+ let mut needs_attention = false;+ for window_id in mux.iter_windows_in_workspace(&session.workspace_name) {+ let Some(window) = mux.get_window(window_id) else {+ continue;+ };+ let tabs = (0..window.len())+ .filter_map(|idx| window.get_by_idx(idx).cloned())+ .collect::<Vec<_>>();+ drop(window);++ for tab in tabs {+ for pane in tab.iter_all_panes() {+ match UiStatusKind::from_progress(&pane.get_progress()) {+ Some(UiStatusKind::Running) => is_working = true,+ Some(UiStatusKind::NeedsAttention) => needs_attention = true,+ Some(UiStatusKind::Done) | None => {}+ }+ if split_leading_legacy_progress_marker(&pane.get_title()).is_some() {+ is_working = true;+ }+ }+ }+ }++ if is_working {+ project_sessions::observe_session_work(&session.id, true);+ return Some(UiStatusKind::Running);+ }++ if needs_attention {+ return Some(UiStatusKind::NeedsAttention);+ }++ let status = project_sessions::observe_session_work(&session.id, false).unwrap_or({+ if session.work_finished_unseen {+ project_sessions::SessionWorkStatus::FinishedUnseen+ } else {+ project_sessions::SessionWorkStatus::Idle+ }+ });+ match status {+ project_sessions::SessionWorkStatus::FinishedUnseen => Some(UiStatusKind::Done),+ project_sessions::SessionWorkStatus::Idle+ | project_sessions::SessionWorkStatus::Running => None,+ }+ }++ fn sidebar_session_dot_color(+ &self,+ session: &project_sessions::SessionView,+ chrome: &UiPalette,+ foreground: LinearRgba,+ ) -> LinearRgba {+ if session.is_active {+ LinearRgba::with_components(0.20, 0.78, 0.36, 1.0)+ } else if session.is_unread {+ chrome.selected_bg+ } else if session.is_pinned {+ foreground.mul_alpha(0.68)+ } else if session.is_materialized {+ foreground.mul_alpha(0.45)+ } else {+ foreground.mul_alpha(0.16)+ }+ }++ fn sidebar_session_status_color(+ &self,+ session: &project_sessions::SessionView,+ status: UiStatusKind,+ chrome: &UiPalette,+ foreground: LinearRgba,+ ) -> LinearRgba {+ if status == UiStatusKind::Done {+ SESSION_STATUS_DONE_COLOR+ } else if session.is_active {+ foreground+ } else {+ self.sidebar_session_dot_color(session, chrome, foreground)+ }+ }++ fn paint_sidebar_session_status(+ &self,+ layers: &mut TripleLayerQuadAllocator,+ session: &project_sessions::SessionView,+ x: usize,+ y: usize,+ row_height: usize,+ chrome: &UiPalette,+ foreground: LinearRgba,+ ) -> anyhow::Result<()> {+ let icon_y = y + ((row_height.saturating_sub(SESSION_STATUS_ICON_SIZE)) / 2);+ if let Some(status) = self.sidebar_session_status_kind(session) {+ let status_size = if matches!(status, UiStatusKind::Running | UiStatusKind::Done) {+ SESSION_STATUS_ACTIVE_ICON_SIZE+ } else {+ SESSION_STATUS_ICON_SIZE+ };+ return self.paint_status_icon(+ layers,+ 2,+ status,+ centered_inner_start(x, SESSION_STATUS_ICON_SIZE, status_size),+ centered_inner_start(y, row_height, status_size),+ status_size,+ self.sidebar_session_status_color(session, status, chrome, foreground),+ );+ }++ let dot_offset = (SESSION_STATUS_ICON_SIZE.saturating_sub(SESSION_STATUS_DOT_SIZE)) / 2;+ let dot_x = x + dot_offset;+ let dot_y = icon_y + dot_offset;+ self.fill_rounded_rectangle(+ layers,+ 1,+ euclid::rect(+ dot_x as f32,+ dot_y as f32,+ SESSION_STATUS_DOT_SIZE as f32,+ SESSION_STATUS_DOT_SIZE as f32,+ ),+ self.sidebar_session_dot_color(session, chrome, foreground),+ SESSION_STATUS_DOT_SIZE as f32 / 2.0,+ )+ .context("sidebar session status dot")+ }+fn workspace_sidebar_content_top(&self, panel_y: usize) -> usize {let base_top = panel_y + SIDEBAR_INSET;if cfg!(target_os = "macos") && !self.window_state.contains(WindowState::FULL_SCREEN) {@@ -244,8 +402,18 @@ impl crate::TermWindow {}let row_height =(ui_cell_height.max(icon_size) + SIDEBAR_INSET).max(SESSION_ROW_MIN_HEIGHT);- let top_action_height = row_height.min(48).max(ui_cell_height + SIDEBAR_INSET);- list_top += top_action_height + SIDEBAR_INSET;+ let top_action_height = row_height.min(48).max(ui_cell_height + SIDEBAR_INSET)+ + if self.window_state.contains(WindowState::FULL_SCREEN) {+ WINDOW_TAB_FULLSCREEN_NEW_SESSION_EXTRA_HEIGHT+ } else {+ 0+ };+ let top_action_y_offset = if self.window_state.contains(WindowState::FULL_SCREEN) {+ WINDOW_TAB_FULLSCREEN_NEW_SESSION_Y_OFFSET+ } else {+ 0+ };+ list_top += top_action_y_offset + top_action_height + SIDEBAR_INSET;let viewport_height = content_bottom.saturating_sub(list_top);if viewport_height == 0 {return 0.0;@@ -293,8 +461,18 @@ impl crate::TermWindow {}let row_height =(ui_cell_height.max(icon_size) + SIDEBAR_INSET).max(SESSION_ROW_MIN_HEIGHT);- let top_action_height = row_height.min(48).max(ui_cell_height + SIDEBAR_INSET);- list_top += top_action_height + SIDEBAR_INSET;+ let top_action_height = row_height.min(48).max(ui_cell_height + SIDEBAR_INSET)+ + if self.window_state.contains(WindowState::FULL_SCREEN) {+ WINDOW_TAB_FULLSCREEN_NEW_SESSION_EXTRA_HEIGHT+ } else {+ 0+ };+ let top_action_y_offset = if self.window_state.contains(WindowState::FULL_SCREEN) {+ WINDOW_TAB_FULLSCREEN_NEW_SESSION_Y_OFFSET+ } else {+ 0+ };+ list_top += top_action_y_offset + top_action_height + SIDEBAR_INSET;let viewport_height = content_bottom.saturating_sub(list_top);if viewport_height == 0 {return None;@@ -424,7 +602,7 @@ impl crate::TermWindow {let show_sidebar_toolbar = self.window_state.contains(WindowState::FULL_SCREEN);let sidebar_toggle_size = WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_SIZE;let sidebar_toggle_x = panel_x + WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_X;- let sidebar_toggle_y = y;+ let sidebar_toggle_y = y + WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_Y_OFFSET;let sidebar_toggle_icon_size =WINDOW_TAB_FULLSCREEN_SIDEBAR_ICON_SIZE.min(sidebar_toggle_size.saturating_sub(2));if show_sidebar_toolbar {@@ -434,19 +612,21 @@ impl crate::TermWindow {sidebar_toggle_size,sidebar_toggle_size,);- self.fill_rounded_rectangle(- layers,- 1,- euclid::rect(- sidebar_toggle_x as f32,- sidebar_toggle_y as f32,- sidebar_toggle_size as f32,- sidebar_toggle_size as f32,- ),- foreground.mul_alpha(if toggle_hovered { 0.14 } else { 0.08 }),- SIDEBAR_ROW_RADIUS,- )- .context("sidebar toolbar toggle button")?;+ if toggle_hovered {+ self.fill_rounded_rectangle(+ layers,+ 1,+ euclid::rect(+ sidebar_toggle_x as f32,+ sidebar_toggle_y as f32,+ sidebar_toggle_size as f32,+ sidebar_toggle_size as f32,+ ),+ foreground.mul_alpha(0.14),+ SIDEBAR_ROW_RADIUS,+ )+ .context("sidebar toolbar toggle button")?;+ }self.ui_items.push(UIItem {x: sidebar_toggle_x,y: sidebar_toggle_y,@@ -466,7 +646,9 @@ impl crate::TermWindow {)?;y += sidebar_toggle_size + SIDEBAR_INSET;}- let section_button_size = button_size.min(34);+ let section_button_size = SIDEBAR_SECTION_ACTION_SIZE+ .max(button_size)+ .min(session_row_height.saturating_sub(8));let settings_footer_height = SIDEBAR_SETTINGS_FOOTER_HEIGHT.min(panel_height);let settings_footer_y = panel_y.saturating_add(panel_height)@@ -477,12 +659,32 @@ impl crate::TermWindow {.iter().find(|project| project.is_active).map(|project| project.id.clone());+ let top_action_y_offset = if show_sidebar_toolbar {+ WINDOW_TAB_FULLSCREEN_NEW_SESSION_Y_OFFSET+ } else {+ 0+ };+ let top_action_extra_height = if show_sidebar_toolbar {+ WINDOW_TAB_FULLSCREEN_NEW_SESSION_EXTRA_HEIGHT+ } else {+ 0+ };let top_action_x = item_x + SIDEBAR_SETTINGS_ROW_SIDE_PADDING;- let top_action_y = y;- let top_action_width = item_width.saturating_sub(SIDEBAR_SETTINGS_ROW_SIDE_PADDING * 2);+ let top_action_y = y + top_action_y_offset;+ let top_action_total_width =+ item_width.saturating_sub(SIDEBAR_SETTINGS_ROW_SIDE_PADDING * 2);+ let top_action_gap = SIDEBAR_ICON_GAP + 4;let top_action_height = session_row_height.min(48)- .max(ui_cell_height + SIDEBAR_INSET);+ .max(ui_cell_height + SIDEBAR_INSET)+ + top_action_extra_height;+ let notification_action_size = top_action_height;+ let notification_action_x = top_action_x+ .saturating_add(top_action_total_width)+ .saturating_sub(notification_action_size);+ let notification_action_y = top_action_y;+ let top_action_width =+ top_action_total_width.saturating_sub(notification_action_size + top_action_gap);let top_action_hovered = active_project_id.is_some()&& self.is_pointer_over_ui_rect(top_action_x,@@ -490,6 +692,12 @@ impl crate::TermWindow {top_action_width,top_action_height,);+ let notification_action_hovered = self.is_pointer_over_ui_rect(+ notification_action_x,+ notification_action_y,+ notification_action_size,+ notification_action_size,+ );self.fill_rounded_rectangle(layers,1,@@ -503,6 +711,23 @@ impl crate::TermWindow {SIDEBAR_ROW_RADIUS + 4.0,).context("sidebar add session button")?;+ self.fill_rounded_rectangle(+ layers,+ 1,+ euclid::rect(+ notification_action_x as f32,+ notification_action_y as f32,+ notification_action_size as f32,+ notification_action_size as f32,+ ),+ foreground.mul_alpha(if notification_action_hovered {+ 0.14+ } else {+ 0.08+ }),+ SIDEBAR_ROW_RADIUS + 4.0,+ )+ .context("sidebar notifications button")?;if let Some(project_id) = active_project_id.clone() {self.ui_items.push(UIItem {x: top_action_x,@@ -512,11 +737,30 @@ impl crate::TermWindow {item_type: UIItemType::ProjectSessionNew(project_id),});}+ self.ui_items.push(UIItem {+ x: notification_action_x,+ y: notification_action_y,+ width: notification_action_size,+ height: notification_action_size,+ item_type: UIItemType::WorkspaceSidebarNotifications,+ });let top_action_icon_size = header_icon_size.min(top_action_height.saturating_sub(14));- let top_action_icon_x = top_action_x + SIDEBAR_SETTINGS_ICON_EXTRA_INSET;+ let top_action_text_max_width = top_action_width+ .saturating_sub(top_action_icon_size + top_action_gap + SIDEBAR_INSET * 2);+ let top_action_label =+ self.ellipsize_sidebar_text(&ui_font, "New Session", top_action_text_max_width)?;+ let top_action_text_width = self+ .sidebar_text_width(&ui_font, top_action_label.as_ref())?+ .ceil()+ .max(0.0) as usize;+ let top_action_content_width =+ top_action_icon_size + top_action_gap + top_action_text_width;+ let top_action_content_x =+ top_action_x + top_action_width.saturating_sub(top_action_content_width) / 2;+ let top_action_icon_x = top_action_content_x;let top_action_icon_y =top_action_y + ((top_action_height.saturating_sub(top_action_icon_size)) / 2);- let top_action_text_x = top_action_icon_x + top_action_icon_size + SIDEBAR_ICON_GAP + 8;+ let top_action_text_x = top_action_icon_x + top_action_icon_size + top_action_gap;let top_action_text_y =top_action_y + ((top_action_height.saturating_sub(ui_cell_height)) / 2);let top_action_fg = if active_project_id.is_some() {@@ -526,7 +770,7 @@ impl crate::TermWindow {};self.paint_sidebar_icon(layers,- SvgIcon::Plus,+ SvgIcon::CirclePlus,top_action_icon_x,top_action_icon_y,top_action_icon_size,@@ -536,15 +780,29 @@ impl crate::TermWindow {layers,&ui_font,ui_metrics,- "Add New Session",+ top_action_label.as_ref(),top_action_text_x,top_action_text_y,- top_action_x- .saturating_add(top_action_width)- .saturating_sub(top_action_text_x + SIDEBAR_INSET),+ top_action_text_width,top_action_fg,)?;- y += top_action_height + SIDEBAR_INSET;+ let notification_icon_size =+ top_action_icon_size.min(notification_action_size.saturating_sub(14));+ self.paint_sidebar_icon(+ layers,+ SvgIcon::Bell,+ notification_action_x+ + ((notification_action_size.saturating_sub(notification_icon_size)) / 2),+ notification_action_y+ + ((notification_action_size.saturating_sub(notification_icon_size)) / 2),+ notification_icon_size,+ if notification_action_hovered {+ foreground+ } else {+ muted_fg+ },+ )?;+ y += top_action_y_offset + top_action_height + SIDEBAR_INSET;let list_top = y;let row_gap = SIDEBAR_ROW_GAP;let max_scroll = {@@ -604,7 +862,8 @@ impl crate::TermWindow {let pinned_x = item_x + SIDEBAR_INSET;let pinned_width = item_width.saturating_sub(SIDEBAR_INSET * 2);- let pinned_text_x = pinned_x + SIDEBAR_INSET;+ let pinned_status_x = pinned_x + SIDEBAR_INSET;+ let pinned_text_x = pinned_status_x + SESSION_STATUS_ICON_SIZE + SIDEBAR_ICON_GAP + 6;for session in &view.pinned_sessions {let row_top = list_top_f + virtual_y as f32 - scroll_offset;let row_bottom = row_top + session_row_height as f32;@@ -678,6 +937,15 @@ impl crate::TermWindow {.saturating_add(pinned_width).saturating_sub(SIDEBAR_INSET)};+ self.paint_sidebar_session_status(+ layers,+ session,+ pinned_status_x,+ y,+ session_row_height,+ &chrome,+ foreground,+ )?;let title = self.sidebar_session_title(&session.id, &session.name);self.paint_sidebar_text(layers,@@ -792,8 +1060,8 @@ impl crate::TermWindow {height: section_button_size,item_type: UIItemType::ProjectNew,});- let section_icon_size =- header_icon_size.min(section_button_size.saturating_sub(10));+ let section_icon_size = header_icon_size+ .min(section_button_size.saturating_sub(SIDEBAR_SECTION_ACTION_ICON_INSET));self.paint_sidebar_icon(layers,SvgIcon::FolderPlus,@@ -819,8 +1087,7 @@ impl crate::TermWindow {let disclosure_x = item_x + SIDEBAR_INSET;let project_icon_x = disclosure_x + disclosure_size + 4;let project_text_x = project_icon_x + icon_size + SIDEBAR_ICON_GAP;- let project_action_size =- section_button_size.min(session_row_height.saturating_sub(12));+ let project_action_size = section_button_size.min(session_row_height.saturating_sub(8));let project_action_x = item_x.saturating_add(item_width).saturating_sub(project_action_size + SIDEBAR_INSET);@@ -890,36 +1157,49 @@ impl crate::TermWindow {)?;}- if row_is_visible && project.is_active {+ if row_is_visible {+ let project_action_y =+ y + ((session_row_height.saturating_sub(project_action_size)) / 2);+ let project_action_hovered = !suppress_hover+ && self.is_pointer_over_ui_rect(+ project_action_x,+ project_action_y,+ project_action_size,+ project_action_size,+ );self.fill_rounded_rectangle(layers,1,euclid::rect(project_action_x as f32,- (y + ((session_row_height.saturating_sub(project_action_size)) / 2)) as f32,+ project_action_y as f32,project_action_size as f32,project_action_size as f32,),- foreground.mul_alpha(0.08),+ foreground.mul_alpha(if project_action_hovered { 0.14 } else { 0.08 }),SIDEBAR_ROW_RADIUS,).context("sidebar new session button")?;self.ui_items.push(UIItem {x: project_action_x,- y: y + ((session_row_height.saturating_sub(project_action_size)) / 2),+ y: project_action_y,width: project_action_size,height: project_action_size,item_type: UIItemType::ProjectSessionNew(project.id.clone()),});- let action_icon_size = header_icon_size.min(project_action_size.saturating_sub(10));+ let action_icon_size = header_icon_size+ .min(project_action_size.saturating_sub(SIDEBAR_SECTION_ACTION_ICON_INSET));self.paint_sidebar_icon(layers,SvgIcon::Plus,project_action_x + ((project_action_size.saturating_sub(action_icon_size)) / 2),- y + ((session_row_height.saturating_sub(project_action_size)) / 2)- + ((project_action_size.saturating_sub(action_icon_size)) / 2),+ project_action_y + ((project_action_size.saturating_sub(action_icon_size)) / 2),action_icon_size,- foreground,+ if project.is_active || project_action_hovered {+ foreground+ } else {+ muted_fg+ },)?;}@@ -929,8 +1209,9 @@ impl crate::TermWindow {let session_x = item_x + SIDEBAR_INSET * 3 + SESSION_ROW_SIDE_PADDING;let session_width =item_width.saturating_sub(SIDEBAR_INSET * 3 + SESSION_ROW_SIDE_PADDING * 2);- let session_dot_x = session_x + SIDEBAR_INSET + 2;- let session_text_x = session_dot_x + SESSION_STATUS_DOT_SIZE + SIDEBAR_ICON_GAP + 8;+ let session_status_x = session_x + SIDEBAR_INSET + 2;+ let session_text_x =+ session_status_x + SESSION_STATUS_ICON_SIZE + SIDEBAR_ICON_GAP + 6;for session in &project.sessions {let row_top = list_top_f + virtual_y as f32 - scroll_offset;@@ -961,8 +1242,6 @@ impl crate::TermWindow {}let text_y = y + ((session_row_height.saturating_sub(ui_cell_height)) / 2);- let dot_y =- y + ((session_row_height.saturating_sub(SESSION_STATUS_DOT_SIZE)) / 2);if row_is_visible {self.ui_items.push(UIItem {x: session_x,@@ -1010,29 +1289,15 @@ impl crate::TermWindow {).context("sidebar hovered session")?;}- self.fill_rounded_rectangle(+ self.paint_sidebar_session_status(layers,- 1,- euclid::rect(- session_dot_x as f32,- dot_y as f32,- SESSION_STATUS_DOT_SIZE as f32,- SESSION_STATUS_DOT_SIZE as f32,- ),- if session.is_active {- LinearRgba::with_components(0.20, 0.78, 0.36, 1.0)- } else if session.is_unread {- chrome.selected_bg- } else if session.is_pinned {- foreground.mul_alpha(0.68)- } else if session.is_materialized {- foreground.mul_alpha(0.45)- } else {- foreground.mul_alpha(0.16)- },- SESSION_STATUS_DOT_SIZE as f32 / 2.0,- )- .context("sidebar session status dot")?;+ session,+ session_status_x,+ y,+ session_row_height,+ &chrome,+ foreground,+ )?;let session_title = self.sidebar_session_title(&session.id, &session.name);self.paint_sidebar_text(layers,@@ -1130,19 +1395,21 @@ impl crate::TermWindow {sidebar_toggle_size,sidebar_toggle_size,);- self.fill_rounded_rectangle(- layers,- 2,- euclid::rect(- sidebar_toggle_x as f32,- sidebar_toggle_y as f32,- sidebar_toggle_size as f32,- sidebar_toggle_size as f32,- ),- foreground.mul_alpha(if toggle_hovered { 0.14 } else { 0.08 }),- SIDEBAR_ROW_RADIUS,- )- .context("sidebar toolbar toggle button repaint")?;+ if toggle_hovered {+ self.fill_rounded_rectangle(+ layers,+ 2,+ euclid::rect(+ sidebar_toggle_x as f32,+ sidebar_toggle_y as f32,+ sidebar_toggle_size as f32,+ sidebar_toggle_size as f32,+ ),+ foreground.mul_alpha(0.14),+ SIDEBAR_ROW_RADIUS,+ )+ .context("sidebar toolbar toggle button repaint")?;+ }self.paint_sidebar_icon(layers,self.workspace_sidebar_toggle_icon(),@@ -1174,6 +1441,29 @@ impl crate::TermWindow {SIDEBAR_ROW_RADIUS + 4.0,).context("sidebar add session button repaint")?;+ let notification_action_hovered = self.is_pointer_over_ui_rect(+ notification_action_x,+ notification_action_y,+ notification_action_size,+ notification_action_size,+ );+ self.fill_rounded_rectangle(+ layers,+ 2,+ euclid::rect(+ notification_action_x as f32,+ notification_action_y as f32,+ notification_action_size as f32,+ notification_action_size as f32,+ ),+ foreground.mul_alpha(if notification_action_hovered {+ 0.14+ } else {+ 0.08+ }),+ SIDEBAR_ROW_RADIUS + 4.0,+ )+ .context("sidebar notifications button repaint")?;let top_action_fg = if active_project_id.is_some() {foreground} else {@@ -1181,7 +1471,7 @@ impl crate::TermWindow {};self.paint_sidebar_icon(layers,- SvgIcon::Plus,+ SvgIcon::CirclePlus,top_action_icon_x,top_action_icon_y,top_action_icon_size,@@ -1191,14 +1481,26 @@ impl crate::TermWindow {layers,&ui_font,ui_metrics,- "Add New Session",+ top_action_label.as_ref(),top_action_text_x,top_action_text_y,- top_action_x- .saturating_add(top_action_width)- .saturating_sub(top_action_text_x + SIDEBAR_INSET),+ top_action_text_width,top_action_fg,)?;+ self.paint_sidebar_icon(+ layers,+ SvgIcon::Bell,+ notification_action_x+ + ((notification_action_size.saturating_sub(notification_icon_size)) / 2),+ notification_action_y+ + ((notification_action_size.saturating_sub(notification_icon_size)) / 2),+ notification_icon_size,+ if notification_action_hovered {+ foreground+ } else {+ muted_fg+ },+ )?;}if max_scroll > 0.0 && scroll_offset > 0.0 {diff --git a/wezterm-gui/src/termwindow/ui/status_icon.rs b/wezterm-gui/src/termwindow/ui/status_icon.rsindex 459baa1f..6c759d9d 100644--- a/wezterm-gui/src/termwindow/ui/status_icon.rs+++ b/wezterm-gui/src/termwindow/ui/status_icon.rs@@ -39,6 +39,25 @@ impl UiStatusKind {}}+pub fn split_leading_legacy_progress_marker(title: &str) -> Option<&str> {+ let trimmed = title.trim_start();+ let mut chars = trimmed.char_indices();+ let (_, ch) = chars.next()?;+ if !is_legacy_progress_marker_char(ch) {+ return None;+ }++ let marker_end = chars.next().map(|(idx, _)| idx).unwrap_or(trimmed.len());+ Some(trimmed[marker_end..].trim_start())+}++fn is_legacy_progress_marker_char(ch: char) -> bool {+ matches!(+ ch as u32,+ 0x2800..=0x28ff | 0xf0130 | 0xf0a9e..=0xf0aa5 | 0xee00..=0xee0b+ )+}+impl TermWindow {pub(crate) fn paint_ui_icon(&self,diff --git a/wezterm-gui/src/termwindow/ui/tokens.rs b/wezterm-gui/src/termwindow/ui/tokens.rsindex ec4be365..eb252025 100644--- a/wezterm-gui/src/termwindow/ui/tokens.rs+++ b/wezterm-gui/src/termwindow/ui/tokens.rs@@ -12,10 +12,13 @@ pub const MACOS_WINDOW_TAB_RESERVED_ACTION_SLOTS: usize = 1;pub const TAB_ROW_START_PADDING: usize = 16;pub const WINDOW_TAB_TOP_SPACER: usize = 4;-pub const WINDOW_TAB_ACTION_RESERVED_WIDTH: usize = 48;+pub const WINDOW_TAB_ACTION_RESERVED_WIDTH: usize = 60;pub const WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_X: usize = 16;-pub const WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_SIZE: usize = 42;-pub const WINDOW_TAB_FULLSCREEN_SIDEBAR_ICON_SIZE: usize = 36;+pub const WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_Y_OFFSET: usize = 4;+pub const WINDOW_TAB_FULLSCREEN_SIDEBAR_BUTTON_SIZE: usize = 52;+pub const WINDOW_TAB_FULLSCREEN_SIDEBAR_ICON_SIZE: usize = 46;+pub const WINDOW_TAB_FULLSCREEN_NEW_SESSION_Y_OFFSET: usize = 6;+pub const WINDOW_TAB_FULLSCREEN_NEW_SESSION_EXTRA_HEIGHT: usize = 6;pub const WINDOW_TAB_LEADING_ACTION_BUTTON_SIZE: usize = 34;pub const WINDOW_TAB_LEADING_ACTION_GAP: usize = 8;pub const WINDOW_TAB_LEADING_ACTION_ICON_SIZE: usize = 26;diff --git a/wezterm-gui/src/termwindow/webgpu.rs b/wezterm-gui/src/termwindow/webgpu.rsindex 0be54acc..5f7bbff6 100644--- a/wezterm-gui/src/termwindow/webgpu.rs+++ b/wezterm-gui/src/termwindow/webgpu.rs@@ -11,6 +11,16 @@ use window::raw_window_handle::{};use window::{BitmapImage, Dimensions, Rect, Window};+fn gpu_debug_enabled() -> bool {+ std::env::var_os("THINKTERM_GPU_DEBUG").is_some()+}++fn gpu_debug(message: impl AsRef<str>) {+ if gpu_debug_enabled() {+ log::info!("[gpu-resource] {}", message.as_ref());+ }+}+#[repr(C)]#[derive(Copy, Clone, Default, Debug, bytemuck::Pod, bytemuck::Zeroable)]pub struct ShaderUniform {@@ -145,6 +155,12 @@ impl WebGpuTexture {} else {vec![]};+ gpu_debug(format!(+ "create WebGpu texture label=Texture Atlas size={}x{} bytes={}",+ width,+ height,+ width as usize * height as usize * 4+ ));let texture = state.device.create_texture(&wgpu::TextureDescriptor {size: wgpu::Extent3d {width,@@ -168,6 +184,17 @@ impl WebGpuTexture {}}+impl Drop for WebGpuTexture {+ fn drop(&mut self) {+ gpu_debug(format!(+ "drop WebGpu texture label=Texture Atlas size={}x{} bytes={}",+ self.width,+ self.height,+ self.width as usize * self.height as usize * 4+ ));+ }+}+pub fn adapter_info_to_gpu_info(info: wgpu::AdapterInfo) -> GpuInfo {GpuInfo {name: info.name,@@ -381,6 +408,10 @@ impl WebGpuState {view_formats,desired_maximum_frame_latency: 2,};+ gpu_debug(format!(+ "configure WebGpu surface initial size={}x{} format={:?} frame_latency={}",+ config.width, config.height, config.format, config.desired_maximum_frame_latency+ ));surface.configure(&device, &config);let shader = device.create_shader_module(wgpu::include_wgsl!("../shader.wgsl"));@@ -547,11 +578,16 @@ impl WebGpuState {if dims == *self.dimensions.borrow() {return;}+ let old = *self.dimensions.borrow();*self.dimensions.borrow_mut() = dims;let mut config = self.config.borrow_mut();config.width = dims.pixel_width as u32;config.height = dims.pixel_height as u32;if config.width > 0 && config.height > 0 {+ gpu_debug(format!(+ "resize WebGpu surface {}x{} -> {}x{}",+ old.pixel_width, old.pixel_height, config.width, config.height+ ));// Avoid reconfiguring with a 0 sized surface, as webgpu will// panic in that case// <https://github.com/wezterm/wezterm/issues/2881>@@ -559,3 +595,13 @@ impl WebGpuState {}}}++impl Drop for WebGpuState {+ fn drop(&mut self) {+ let dims = *self.dimensions.borrow();+ gpu_debug(format!(+ "drop WebGpu state surface size={}x{}",+ dims.pixel_width, dims.pixel_height+ ));+ }+}diff --git a/window/src/os/macos/app.rs b/window/src/os/macos/app.rsindex 148ecfaf..50101e81 100644--- a/window/src/os/macos/app.rs+++ b/window/src/os/macos/app.rs@@ -165,7 +165,12 @@ extern "C" fn thinkterm_order_front_standard_about_panel(let app_name = nsstring("ThinkTerm");let empty_app_version = nsstring("");let empty_build_version = nsstring("");- let loaded_icon = thinkterm_icon_path().and_then(|path| load_thinkterm_icon(&path));+ let current_icon: id = msg_send![app, applicationIconImage];+ let loaded_icon = if current_icon == nil {+ thinkterm_icon_path().and_then(|path| load_thinkterm_icon(&path))+ } else {+ None+ };let mut keys = vec![NSAboutPanelOptionApplicationName,@@ -174,13 +179,17 @@ extern "C" fn thinkterm_order_front_standard_about_panel(];let mut objects = vec![*app_name, *empty_app_version, *empty_build_version];- let app_icon = if let Some(icon) = loaded_icon.as_ref() {+ let app_icon = if current_icon != nil {+ current_icon+ } else if let Some(icon) = loaded_icon.as_ref() {**icon} else {- msg_send![app, applicationIconImage]+ nil};if app_icon != nil {- let () = msg_send![app, setApplicationIconImage: app_icon];+ if current_icon == nil {+ let () = msg_send![app, setApplicationIconImage: app_icon];+ }keys.push(NSAboutPanelOptionApplicationIcon);objects.push(app_icon);}