diff options
| author | user <user@clank> | 2026-08-08 22:47:16 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-08 22:47:16 +0200 |
| commit | 9aa323fe6b9d15360ba54a1c73a216228664a289 (patch) | |
| tree | 9463fcffa23cbfa69c6fca0b35f4dd24341f25d0 /zellij-utils | |
| parent | sl0p: grayscale idle panes too (neovim stayed in colour) (diff) | |
| download | sl0ppij-9aa323fe6b9d15360ba54a1c73a216228664a289.tar.gz sl0ppij-9aa323fe6b9d15360ba54a1c73a216228664a289.tar.xz sl0ppij-9aa323fe6b9d15360ba54a1c73a216228664a289.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.
Diffstat (limited to 'zellij-utils')
| -rw-r--r-- | zellij-utils/src/data.rs | 2 | ||||
| -rw-r--r-- | zellij-utils/src/input/config.rs | 1 | ||||
| -rw-r--r-- | zellij-utils/src/input/theme.rs | 5 | ||||
| -rw-r--r-- | zellij-utils/src/kdl/mod.rs | 10 | ||||
| -rw-r--r-- | zellij-utils/src/plugin_api/event.rs | 1 | ||||
| -rw-r--r-- | zellij-utils/src/plugin_api/style.rs | 1 |
6 files changed, 20 insertions, 0 deletions
diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs index 9f9205db..2caedf8f 100644 --- a/zellij-utils/src/data.rs +++ b/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/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs index 77260ff8..7b870332 100644 --- a/zellij-utils/src/input/config.rs +++ b/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/zellij-utils/src/input/theme.rs b/zellij-utils/src/input/theme.rs index e1371f85..45ae763b 100644 --- a/zellij-utils/src/input/theme.rs +++ b/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/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs index cae59ff6..8d7f4d9d 100644 --- a/zellij-utils/src/kdl/mod.rs +++ b/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/zellij-utils/src/plugin_api/event.rs b/zellij-utils/src/plugin_api/event.rs index 0303ec1f..0dafec64 100644 --- a/zellij-utils/src/plugin_api/event.rs +++ b/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/zellij-utils/src/plugin_api/style.rs b/zellij-utils/src/plugin_api/style.rs index cb896c76..cf554351 100644 --- a/zellij-utils/src/plugin_api/style.rs +++ b/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(), }) } } |
