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 /zellij-utils | |
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 'zellij-utils')
10 files changed, 17 insertions, 7 deletions
diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs index f5c4828e3..6da375f51 100644 --- a/zellij-utils/src/data.rs +++ b/zellij-utils/src/data.rs @@ -643,6 +643,7 @@ pub struct Palette { pub struct Style { pub colors: Palette, pub rounded_corners: bool, + pub hide_session_name: bool, } // FIXME: Poor devs hashtable since HashTable can't derive `Default`... diff --git a/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs index 5cdc509ff..9d0c6da39 100644 --- a/zellij-utils/src/input/config.rs +++ b/zellij-utils/src/input/config.rs @@ -639,6 +639,7 @@ mod config_test { ui { pane_frames { rounded_corners true + hide_session_name true } } "#; @@ -646,6 +647,7 @@ mod config_test { let expected_ui_config = UiConfig { pane_frames: FrameConfig { rounded_corners: true, + hide_session_name: true, }, }; 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 c76deb31f..bf0edf232 100644 --- a/zellij-utils/src/input/theme.rs +++ b/zellij-utils/src/input/theme.rs @@ -25,12 +25,14 @@ impl UiConfig { #[derive(Debug, Default, Clone, Copy, PartialEq, Deserialize, Serialize)] pub struct FrameConfig { pub rounded_corners: bool, + pub hide_session_name: bool, } impl FrameConfig { pub fn merge(&self, other: FrameConfig) -> Self { let mut merged = self.clone(); merged.rounded_corners = other.rounded_corners; + merged.hide_session_name = other.hide_session_name; merged } } diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs index 1bd1356c1..fa11077c0 100644 --- a/zellij-utils/src/kdl/mod.rs +++ b/zellij-utils/src/kdl/mod.rs @@ -1701,7 +1701,12 @@ impl UiConfig { let rounded_corners = kdl_children_property_first_arg_as_bool!(pane_frames, "rounded_corners") .unwrap_or(false); - let frame_config = FrameConfig { rounded_corners }; + let hide_session_name = + kdl_get_child_entry_bool_value!(pane_frames, "hide_session_name").unwrap_or(false); + let frame_config = FrameConfig { + rounded_corners, + hide_session_name, + }; ui_config.pane_frames = frame_config; } Ok(ui_config) diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap index 6ba666801..a51321f89 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__default_config_with_no_cli_arguments.snap @@ -1,6 +1,5 @@ --- source: zellij-utils/src/setup.rs -assertion_line: 621 expression: "format!(\"{:#?}\", config)" --- Config { @@ -3604,6 +3603,7 @@ Config { ui: UiConfig { pane_frames: FrameConfig { rounded_corners: false, + hide_session_name: false, }, }, env: {}, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap index 97a16c77b..226385df8 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_env_vars_override_config_env_vars.snap @@ -1,6 +1,5 @@ --- source: zellij-utils/src/setup.rs -assertion_line: 679 expression: "format!(\"{:#?}\", config)" --- Config { @@ -3604,6 +3603,7 @@ Config { ui: UiConfig { pane_frames: FrameConfig { rounded_corners: false, + hide_session_name: false, }, }, env: { diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap index e8d8bccbc..55574997d 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_keybinds_override_config_keybinds.snap @@ -1,6 +1,5 @@ --- source: zellij-utils/src/setup.rs -assertion_line: 696 expression: "format!(\"{:#?}\", config)" --- Config { @@ -144,6 +143,7 @@ Config { ui: UiConfig { pane_frames: FrameConfig { rounded_corners: false, + hide_session_name: false, }, }, env: {}, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap index 2b07b2f9b..772eb5266 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_plugins_override_config_plugins.snap @@ -1,6 +1,5 @@ --- source: zellij-utils/src/setup.rs -assertion_line: 707 expression: "format!(\"{:#?}\", config)" --- Config { @@ -3618,6 +3617,7 @@ Config { ui: UiConfig { pane_frames: FrameConfig { rounded_corners: false, + hide_session_name: false, }, }, env: {}, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap index 13e440e0d..e4532bbe3 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_themes_override_config_themes.snap @@ -1,6 +1,5 @@ --- source: zellij-utils/src/setup.rs -assertion_line: 721 expression: "format!(\"{:#?}\", config)" --- Config { @@ -3908,6 +3907,7 @@ Config { ui: UiConfig { pane_frames: FrameConfig { rounded_corners: false, + hide_session_name: false, }, }, env: {}, diff --git a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap index 072f21828..001041fce 100644 --- a/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap +++ b/zellij-utils/src/snapshots/zellij_utils__setup__setup_test__layout_ui_config_overrides_config_ui_config.snap @@ -1,6 +1,5 @@ --- source: zellij-utils/src/setup.rs -assertion_line: 693 expression: "format!(\"{:#?}\", config)" --- Config { @@ -3604,6 +3603,7 @@ Config { ui: UiConfig { pane_frames: FrameConfig { rounded_corners: true, + hide_session_name: false, }, }, env: {}, |