diff options
author | Marcel Baur <mail@marcelbaur.io> | 2023-03-30 13:33:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-30 20:33:39 +0900 |
commit | 6ea5c3666fa2f38742da115d5fe5beef30eccc2f (patch) | |
tree | 7e9445b1be581826c3cec0984034ebe04b47ead2 /default-plugins | |
parent | 7f1dde5520ceac3d653dae7adec17c2fdaf83f8b (diff) |
Add option to hide session name in tab-bar (deriving from #2172) (#2301)
* feat(tab-bar): add option to hide prefix (#2172)
* feat(tab-bar): only hide session_name
* fix(snapshots): update snapshots with new config-var naming
---------
Co-authored-by: Marcel Baur <marcel@baur.gg>
Diffstat (limited to 'default-plugins')
-rw-r--r-- | default-plugins/tab-bar/src/line.rs | 6 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/main.rs | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs index cb24873a9..668507a01 100644 --- a/default-plugins/tab-bar/src/line.rs +++ b/default-plugins/tab-bar/src/line.rs @@ -223,6 +223,7 @@ pub fn tab_line( cols: usize, palette: Palette, capabilities: PluginCapabilities, + hide_session_name: bool, ) -> Vec<LinePart> { let mut tabs_after_active = all_tabs.split_off(active_tab_index); let mut tabs_before_active = all_tabs; @@ -231,7 +232,10 @@ pub fn tab_line( } else { tabs_before_active.pop().unwrap() }; - let mut prefix = tab_line_prefix(session_name, palette, cols); + let mut prefix = match hide_session_name { + true => tab_line_prefix(None, palette, cols), + false => tab_line_prefix(session_name, palette, cols), + }; let prefix_len = get_current_title_len(&prefix); // if active tab alone won't fit in cols, don't draw any tabs diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs index 6f0456a8f..2df6a13df 100644 --- a/default-plugins/tab-bar/src/main.rs +++ b/default-plugins/tab-bar/src/main.rs @@ -120,6 +120,7 @@ impl ZellijPlugin for State { cols.saturating_sub(1), self.mode_info.style.colors, self.mode_info.capabilities, + self.mode_info.style.hide_session_name, ); let mut s = String::new(); let mut len_cnt = 0; |