diff options
| author | user <user@clank> | 2026-08-08 22:47:16 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-12 19:34:19 +0200 |
| commit | 425cf121f9920e6f4a06aa4a185e87be004246b3 (patch) | |
| tree | efd49017efe75a7cc8662989ded13b1952485d56 | |
| parent | sl0p: grayscale idle panes too (neovim stayed in colour) (diff) | |
| download | sl0ppi-425cf121f9920e6f4a06aa4a185e87be004246b3.tar.gz sl0ppi-425cf121f9920e6f4a06aa4a185e87be004246b3.tar.xz sl0ppi-425cf121f9920e6f4a06aa4a185e87be004246b3.zip | |
sl0p: optionally hide the 'Pane #N' placeholder title
`ui { pane_frames { hide_default_pane_names true } }`, default false.
A pane now shows no title at all until something actually names it: the user
renaming it (including by double-clicking the title row) or the running
program setting a title. Upstream always shows an auto-generated 'Pane #N'.
Implemented by tracking whether pane_title is still the constructor's
placeholder, NOT by matching the string: a program that legitimately titles
itself 'Pane #3' must not be mistaken for an unnamed pane. set_title clears
the flag, since something then chose that title.
current_title reads the option at render time rather than baking an empty
title in at construction, so it hot-reloads and turning the option back off
restores the placeholder on existing panes.
Display precedence is unchanged and now explicit in the code:
user-given name > title set by the running program > placeholder
render_terminal_title already fell back to an empty string rather than the
placeholder, so the terminal WINDOW title is unaffected.
Empty titles were already handled by the frame renderer
(render_title_left_side returns None for an empty title), including the
sl0p centred/right alignment path.
Baselines held: zellij-server 1436/30, zellij-utils 436/5.
| -rw-r--r-- | sl0ppij/README.md | 7 | ||||
| -rw-r--r-- | sl0ppij/zellij-client/src/web_client/server_listener.rs | 1 | ||||
| -rw-r--r-- | sl0ppij/zellij-server/src/lib.rs | 3 | ||||
| -rw-r--r-- | sl0ppij/zellij-server/src/panes/floating_panes/mod.rs | 4 | ||||
| -rw-r--r-- | sl0ppij/zellij-server/src/panes/plugin_pane.rs | 2 | ||||
| -rw-r--r-- | sl0ppij/zellij-server/src/panes/terminal_pane.rs | 34 | ||||
| -rw-r--r-- | sl0ppij/zellij-server/src/panes/tiled_panes/mod.rs | 4 | ||||
| -rw-r--r-- | sl0ppij/zellij-server/src/screen.rs | 5 | ||||
| -rw-r--r-- | sl0ppij/zellij-server/src/tab/mod.rs | 9 | ||||
| -rw-r--r-- | sl0ppij/zellij-utils/src/data.rs | 2 | ||||
| -rw-r--r-- | sl0ppij/zellij-utils/src/input/config.rs | 1 | ||||
| -rw-r--r-- | sl0ppij/zellij-utils/src/input/theme.rs | 5 | ||||
| -rw-r--r-- | sl0ppij/zellij-utils/src/kdl/mod.rs | 10 | ||||
| -rw-r--r-- | sl0ppij/zellij-utils/src/plugin_api/event.rs | 1 | ||||
| -rw-r--r-- | sl0ppij/zellij-utils/src/plugin_api/style.rs | 1 |
15 files changed, 76 insertions, 13 deletions
diff --git a/sl0ppij/README.md b/sl0ppij/README.md index 77d77c5..198a950 100644 --- a/sl0ppij/README.md +++ b/sl0ppij/README.md @@ -34,6 +34,13 @@ ui { // padding 1 2 3 4 up=1 down=2 left=3 right=4 padding 1 // default: 0 + // Show no pane title until something actually names the pane: either + // you rename it, or the running program sets a title. Upstream always + // shows a "Pane #N" placeholder. Tracked as a flag rather than by + // matching the string, so a program that genuinely titles itself + // "Pane #3" is not mistaken for an unnamed pane. + hide_default_pane_names true + // Desaturate the CONTENT of unfocused panes, 0-100 (default 0 = off). // Colours are blended toward their own perceptual luminance, so an // unfocused pane keeps its brightness but drains of colour. This is diff --git a/sl0ppij/zellij-client/src/web_client/server_listener.rs b/sl0ppij/zellij-client/src/web_client/server_listener.rs index 9727087..d96433d 100644 --- a/sl0ppij/zellij-client/src/web_client/server_listener.rs +++ b/sl0ppij/zellij-client/src/web_client/server_listener.rs @@ -88,6 +88,7 @@ pub fn zellij_server_listener( pane_gap_y: config.ui.pane_frames.resolved_gap().1, pane_padding: config.ui.pane_frames.resolved_padding(), inactive_pane_grayscale: config.ui.pane_frames.inactive_grayscale, + hide_default_pane_names: config.ui.pane_frames.hide_default_pane_names, }, }; diff --git a/sl0ppij/zellij-server/src/lib.rs b/sl0ppij/zellij-server/src/lib.rs index aaf8c07..43101ea 100644 --- a/sl0ppij/zellij-server/src/lib.rs +++ b/sl0ppij/zellij-server/src/lib.rs @@ -464,6 +464,7 @@ impl SessionMetaData { pane_gap_y: new_config.ui.pane_frames.resolved_gap().1, pane_padding: new_config.ui.pane_frames.resolved_padding(), inactive_pane_grayscale: new_config.ui.pane_frames.inactive_grayscale, + hide_default_pane_names: new_config.ui.pane_frames.hide_default_pane_names, stacked_resize: new_config.options.stacked_resize.unwrap_or(true), stacked_pane_list: new_config.options.stacked_pane_list.unwrap_or(true), default_editor: new_config.options.scrollback_editor.clone(), @@ -1010,6 +1011,7 @@ pub fn start_server_impl( pane_gap_y: config.ui.pane_frames.resolved_gap().1, pane_padding: config.ui.pane_frames.resolved_padding(), inactive_pane_grayscale: config.ui.pane_frames.inactive_grayscale, + hide_default_pane_names: config.ui.pane_frames.hide_default_pane_names, }, }; @@ -1198,6 +1200,7 @@ pub fn start_server_impl( pane_gap_y: config.ui.pane_frames.resolved_gap().1, pane_padding: config.ui.pane_frames.resolved_padding(), inactive_pane_grayscale: config.ui.pane_frames.inactive_grayscale, + hide_default_pane_names: config.ui.pane_frames.hide_default_pane_names, }, }; diff --git a/sl0ppij/zellij-server/src/panes/floating_panes/mod.rs b/sl0ppij/zellij-server/src/panes/floating_panes/mod.rs index fba3d53..7d0d9ed 100644 --- a/sl0ppij/zellij-server/src/panes/floating_panes/mod.rs +++ b/sl0ppij/zellij-server/src/panes/floating_panes/mod.rs @@ -1735,14 +1735,16 @@ impl FloatingPanes { gap_y: usize, padding: zellij_utils::data::PanePadding, inactive_grayscale: u8, + hide_default_pane_names: bool, ) { self.style.pane_title_alignment = title_alignment; self.style.pane_gap_x = gap_x; self.style.pane_gap_y = gap_y; self.style.pane_padding = padding; self.style.inactive_pane_grayscale = inactive_grayscale; + self.style.hide_default_pane_names = hide_default_pane_names; for pane in self.panes.values_mut() { - pane.update_frame_layout(title_alignment, gap_x, gap_y, padding, inactive_grayscale); + pane.update_frame_layout(title_alignment, gap_x, gap_y, padding, inactive_grayscale, hide_default_pane_names); } // Unlike the tiled panes, `set_pane_frame_style` only re-runs the // content-offset sweep for a fullscreen floating pane, so gap/padding diff --git a/sl0ppij/zellij-server/src/panes/plugin_pane.rs b/sl0ppij/zellij-server/src/panes/plugin_pane.rs index 8899e0a..489ccc4 100644 --- a/sl0ppij/zellij-server/src/panes/plugin_pane.rs +++ b/sl0ppij/zellij-server/src/panes/plugin_pane.rs @@ -942,12 +942,14 @@ impl Pane for PluginPane { gap_y: usize, padding: zellij_utils::data::PanePadding, inactive_grayscale: u8, + hide_default_pane_names: bool, ) { self.style.pane_title_alignment = title_alignment; self.style.pane_gap_x = gap_x; self.style.pane_gap_y = gap_y; self.style.pane_padding = padding; self.style.inactive_pane_grayscale = inactive_grayscale; + self.style.hide_default_pane_names = hide_default_pane_names; self.frame.clear(); } fn set_should_be_suppressed(&mut self, should_be_suppressed: bool) { diff --git a/sl0ppij/zellij-server/src/panes/terminal_pane.rs b/sl0ppij/zellij-server/src/panes/terminal_pane.rs index fa6005d..77404f8 100644 --- a/sl0ppij/zellij-server/src/panes/terminal_pane.rs +++ b/sl0ppij/zellij-server/src/panes/terminal_pane.rs @@ -147,6 +147,11 @@ pub struct TerminalPane { /// Whether this pane currently draws a frame. See set_frame(). draws_frame: bool, pane_title: String, + /// True while `pane_title` is still the auto-generated "Pane #N" placeholder + /// rather than a title anything actually chose. Tracked instead of matching + /// on the string, so a program that legitimately sets its title to + /// "Pane #3" is not mistaken for an unnamed pane. + pane_title_is_placeholder: bool, pane_name: String, prev_pane_name: String, frame: HashMap<ClientId, PaneFrame>, @@ -1208,17 +1213,26 @@ impl Pane for TerminalPane { } fn set_title(&mut self, title: String) { self.pane_title = title; + // something chose this title, so it is no longer a placeholder + self.pane_title_is_placeholder = false; } fn current_title(&self) -> String { - if self.pane_name.is_empty() { - self.grid - .title - .as_deref() - .unwrap_or(&self.pane_title) - .into() - } else { - self.pane_name.to_owned() + // precedence: user-given name > title set by the running program > + // the "Pane #N" placeholder + if !self.pane_name.is_empty() { + return self.pane_name.to_owned(); + } + if let Some(program_title) = self.grid.title.as_deref() { + return program_title.into(); + } + if self.pane_title_is_placeholder && self.style.hide_default_pane_names { + // nothing has named this pane: show no title at all rather than + // "Pane #3". Read from style at render time so the option + // hot-reloads and the placeholder is still there if it is turned + // back off. + return String::new(); } + self.pane_title.clone() } fn stack_list_entry_label(&self) -> String { self.title_with_bell_indicator(self.current_title()) @@ -1295,12 +1309,14 @@ impl Pane for TerminalPane { gap_y: usize, padding: zellij_utils::data::PanePadding, inactive_grayscale: u8, + hide_default_pane_names: bool, ) { self.style.pane_title_alignment = title_alignment; self.style.pane_gap_x = gap_x; self.style.pane_gap_y = gap_y; self.style.pane_padding = padding; self.style.inactive_pane_grayscale = inactive_grayscale; + self.style.hide_default_pane_names = hide_default_pane_names; self.frame.clear(); } fn drain_fake_cursors(&mut self) -> Option<HashSet<(usize, usize)>> { @@ -1452,6 +1468,7 @@ impl TerminalPane { explicitly_disable_keyboard_protocol: bool, mut notification_end: Option<NotificationEnd>, ) -> TerminalPane { + let pane_title_is_placeholder = initial_pane_title.is_none(); let initial_pane_title = initial_pane_title.unwrap_or_else(|| format!("Pane #{}", pane_index)); let grid = Grid::new( @@ -1488,6 +1505,7 @@ impl TerminalPane { style, selection_scrolled_at: time::Instant::now(), pane_title: initial_pane_title, + pane_title_is_placeholder, pane_name: pane_name.clone(), prev_pane_name: pane_name, borderless: false, diff --git a/sl0ppij/zellij-server/src/panes/tiled_panes/mod.rs b/sl0ppij/zellij-server/src/panes/tiled_panes/mod.rs index 23eb4ae..bfae1ad 100644 --- a/sl0ppij/zellij-server/src/panes/tiled_panes/mod.rs +++ b/sl0ppij/zellij-server/src/panes/tiled_panes/mod.rs @@ -3169,14 +3169,16 @@ impl TiledPanes { gap_y: usize, padding: zellij_utils::data::PanePadding, inactive_grayscale: u8, + hide_default_pane_names: bool, ) { self.style.pane_title_alignment = title_alignment; self.style.pane_gap_x = gap_x; self.style.pane_gap_y = gap_y; self.style.pane_padding = padding; self.style.inactive_pane_grayscale = inactive_grayscale; + self.style.hide_default_pane_names = hide_default_pane_names; for pane in self.panes.values_mut() { - pane.update_frame_layout(title_alignment, gap_x, gap_y, padding, inactive_grayscale); + pane.update_frame_layout(title_alignment, gap_x, gap_y, padding, inactive_grayscale, hide_default_pane_names); } } pub fn stack_panes( diff --git a/sl0ppij/zellij-server/src/screen.rs b/sl0ppij/zellij-server/src/screen.rs index 0a1c07e..d4a02cd 100644 --- a/sl0ppij/zellij-server/src/screen.rs +++ b/sl0ppij/zellij-server/src/screen.rs @@ -781,6 +781,7 @@ pub enum ScreenInstruction { pane_gap_y: usize, pane_padding: PanePadding, inactive_pane_grayscale: u8, + hide_default_pane_names: bool, stacked_resize: bool, stacked_pane_list: bool, default_editor: Option<PathBuf>, @@ -6272,6 +6273,7 @@ impl Screen { pane_gap_y: usize, pane_padding: PanePadding, inactive_pane_grayscale: u8, + hide_default_pane_names: bool, stacked_resize: bool, stacked_pane_list: bool, default_editor: Option<PathBuf>, @@ -6337,6 +6339,7 @@ impl Screen { pane_gap_y, pane_padding, inactive_pane_grayscale, + hide_default_pane_names, ); tab.set_pane_frames(pane_frame_style); tab.update_arrow_fonts(should_support_arrow_fonts); @@ -10858,6 +10861,7 @@ pub(crate) fn screen_thread_main( pane_gap_y, pane_padding, inactive_pane_grayscale, + hide_default_pane_names, stacked_resize, stacked_pane_list, default_editor, @@ -10890,6 +10894,7 @@ pub(crate) fn screen_thread_main( pane_gap_y, pane_padding, inactive_pane_grayscale, + hide_default_pane_names, stacked_resize, stacked_pane_list, default_editor, diff --git a/sl0ppij/zellij-server/src/tab/mod.rs b/sl0ppij/zellij-server/src/tab/mod.rs index 18945a6..08ee4bc 100644 --- a/sl0ppij/zellij-server/src/tab/mod.rs +++ b/sl0ppij/zellij-server/src/tab/mod.rs @@ -778,6 +778,7 @@ pub trait Pane { _gap_y: usize, _padding: zellij_utils::data::PanePadding, _inactive_grayscale: u8, + _hide_default_pane_names: bool, ) { } fn set_should_be_suppressed(&mut self, _should_be_suppressed: bool) {} @@ -7448,18 +7449,20 @@ impl Tab { gap_y: usize, padding: zellij_utils::data::PanePadding, inactive_grayscale: u8, + hide_default_pane_names: bool, ) { self.style.pane_title_alignment = title_alignment; self.style.pane_gap_x = gap_x; self.style.pane_gap_y = gap_y; self.style.pane_padding = padding; self.style.inactive_pane_grayscale = inactive_grayscale; + self.style.hide_default_pane_names = hide_default_pane_names; self.floating_panes - .update_pane_frame_layout(title_alignment, gap_x, gap_y, padding, inactive_grayscale); + .update_pane_frame_layout(title_alignment, gap_x, gap_y, padding, inactive_grayscale, hide_default_pane_names); self.tiled_panes - .update_pane_frame_layout(title_alignment, gap_x, gap_y, padding, inactive_grayscale); + .update_pane_frame_layout(title_alignment, gap_x, gap_y, padding, inactive_grayscale, hide_default_pane_names); for (_, pane) in self.suppressed_panes.values_mut() { - pane.update_frame_layout(title_alignment, gap_x, gap_y, padding, inactive_grayscale); + pane.update_frame_layout(title_alignment, gap_x, gap_y, padding, inactive_grayscale, hide_default_pane_names); } } pub fn update_arrow_fonts(&mut self, should_support_arrow_fonts: bool) { diff --git a/sl0ppij/zellij-utils/src/data.rs b/sl0ppij/zellij-utils/src/data.rs index 9f9205d..2caedf8 100644 --- a/sl0ppij/zellij-utils/src/data.rs +++ b/sl0ppij/zellij-utils/src/data.rs @@ -1468,6 +1468,8 @@ pub struct Style { /// Desaturation strength (0-100) applied to the CONTENT of panes this /// client is not focused on. 0 = off. pub inactive_pane_grayscale: u8, + /// Suppress the auto-generated "Pane #N" placeholder title. + pub hide_default_pane_names: bool, } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)] diff --git a/sl0ppij/zellij-utils/src/input/config.rs b/sl0ppij/zellij-utils/src/input/config.rs index 77260ff..7b87033 100644 --- a/sl0ppij/zellij-utils/src/input/config.rs +++ b/sl0ppij/zellij-utils/src/input/config.rs @@ -1457,6 +1457,7 @@ mod config_test { padding: Default::default(), gap_aspect: 2, // parser default; see FrameConfig::default() inactive_grayscale: 0, + hide_default_pane_names: false, }, }; assert_eq!(config.ui, expected_ui_config, "Ui config defined in config"); diff --git a/sl0ppij/zellij-utils/src/input/theme.rs b/sl0ppij/zellij-utils/src/input/theme.rs index e1371f8..45ae763 100644 --- a/sl0ppij/zellij-utils/src/input/theme.rs +++ b/sl0ppij/zellij-utils/src/input/theme.rs @@ -40,6 +40,9 @@ pub struct FrameConfig { /// How strongly to desaturate the CONTENT of unfocused panes, 0-100. /// 0 disables it entirely (the default). pub inactive_grayscale: u8, + /// Omit the auto-generated "Pane #N" placeholder title, so a pane shows no + /// name until the user sets one or the running program sets a title. + pub hide_default_pane_names: bool, } /// Hand-written rather than derived: `gap_aspect` must default to 2 to match @@ -56,6 +59,7 @@ impl Default for FrameConfig { padding: Default::default(), gap_aspect: 2, inactive_grayscale: 0, + hide_default_pane_names: false, } } } @@ -83,6 +87,7 @@ impl FrameConfig { merged.padding = other.padding; merged.gap_aspect = other.gap_aspect; merged.inactive_grayscale = other.inactive_grayscale; + merged.hide_default_pane_names = other.hide_default_pane_names; merged } } diff --git a/sl0ppij/zellij-utils/src/kdl/mod.rs b/sl0ppij/zellij-utils/src/kdl/mod.rs index cae59ff..8d7f4d9 100644 --- a/sl0ppij/zellij-utils/src/kdl/mod.rs +++ b/sl0ppij/zellij-utils/src/kdl/mod.rs @@ -5599,6 +5599,9 @@ impl UiConfig { kdl_children_property_first_arg_as_i64!(pane_frames, "inactive_grayscale") .unwrap_or(0) .clamp(0, 100) as u8; + let hide_default_pane_names = + kdl_children_property_first_arg_as_bool!(pane_frames, "hide_default_pane_names") + .unwrap_or(false); let frame_config = FrameConfig { rounded_corners, hide_session_name, @@ -5607,6 +5610,7 @@ impl UiConfig { padding, gap_aspect, inactive_grayscale, + hide_default_pane_names, }; ui_config.pane_frames = frame_config; } @@ -5664,6 +5668,12 @@ impl UiConfig { } frame_config_children.nodes_mut().push(padding); } + if self.pane_frames.hide_default_pane_names { + has_ui_config = true; + let mut node = KdlNode::new("hide_default_pane_names"); + node.push(KdlValue::Bool(true)); + frame_config_children.nodes_mut().push(node); + } if self.pane_frames.inactive_grayscale > 0 { has_ui_config = true; let mut node = KdlNode::new("inactive_grayscale"); diff --git a/sl0ppij/zellij-utils/src/plugin_api/event.rs b/sl0ppij/zellij-utils/src/plugin_api/event.rs index 0303ec1..0dafec6 100644 --- a/sl0ppij/zellij-utils/src/plugin_api/event.rs +++ b/sl0ppij/zellij-utils/src/plugin_api/event.rs @@ -2497,6 +2497,7 @@ fn serialize_mode_update_event_with_non_default_values() { pane_gap_y: Default::default(), pane_padding: Default::default(), inactive_pane_grayscale: Default::default(), + hide_default_pane_names: Default::default(), }, capabilities: PluginCapabilities { arrow_fonts: false }, session_name: Some("my awesome test session".to_owned()), diff --git a/sl0ppij/zellij-utils/src/plugin_api/style.rs b/sl0ppij/zellij-utils/src/plugin_api/style.rs index cb896c7..cf55435 100644 --- a/sl0ppij/zellij-utils/src/plugin_api/style.rs +++ b/sl0ppij/zellij-utils/src/plugin_api/style.rs @@ -30,6 +30,7 @@ impl TryFrom<ProtobufStyle> for Style { pane_gap_y: Default::default(), pane_padding: Default::default(), inactive_pane_grayscale: Default::default(), + hide_default_pane_names: Default::default(), }) } } |
