diff options
author | Aram Drevekenin <aram@poor.dev> | 2024-07-05 15:13:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-05 15:13:51 +0200 |
commit | a6d6c0e4ff03c35cafb6f04363ecab856ee3682d (patch) | |
tree | eadf1c24c4c6a1e4b7499b3cd047351fd29e52de /default-plugins/tab-bar/src/main.rs | |
parent | 8e33b20559ecddcaba17e5cc8d6f05b638718cac (diff) |
feat(ui): status bar redesign (#3475)
* work
* work
* working
* get default mode from server and some ui responsiveness
* work
* finish design and get tests to pass
* get e2e tests to pass
* add classic layout
* add classic layout assets
* fix e2e tests
* style(fmt): rustfmt
* fix plugin system test
* style(fmt): some cleanups
Diffstat (limited to 'default-plugins/tab-bar/src/main.rs')
-rw-r--r-- | default-plugins/tab-bar/src/main.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs index 208558251..8230467d1 100644 --- a/default-plugins/tab-bar/src/main.rs +++ b/default-plugins/tab-bar/src/main.rs @@ -18,12 +18,20 @@ pub struct LinePart { tab_index: Option<usize>, } +impl LinePart { + pub fn append(&mut self, to_append: &LinePart) { + self.part.push_str(&to_append.part); + self.len += to_append.len; + } +} + #[derive(Default)] struct State { tabs: Vec<TabInfo>, active_tab_idx: usize, mode_info: ModeInfo, tab_line: Vec<LinePart>, + hide_swap_layout_indication: bool, } static ARROW_SEPARATOR: &str = ""; @@ -31,7 +39,11 @@ static ARROW_SEPARATOR: &str = ""; register_plugin!(State); impl ZellijPlugin for State { - fn load(&mut self, _configuration: BTreeMap<String, String>) { + fn load(&mut self, configuration: BTreeMap<String, String>) { + self.hide_swap_layout_indication = configuration + .get("hide_swap_layout_indication") + .map(|s| s == "true") + .unwrap_or(false); set_selectable(false); subscribe(&[ EventType::TabUpdate, @@ -120,6 +132,9 @@ impl ZellijPlugin for State { self.mode_info.style.colors, self.mode_info.capabilities, self.mode_info.style.hide_session_name, + self.tabs.iter().find(|t| t.active), + &self.mode_info, + self.hide_swap_layout_indication, ); let output = self |