diff options
Diffstat (limited to 'zellij-utils/src/input/layout.rs')
-rw-r--r-- | zellij-utils/src/input/layout.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index 2bbc8cb48..df976b8e1 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -144,6 +144,8 @@ pub struct Layout { #[serde(default)] pub struct LayoutFromYaml { #[serde(default)] + pub session: SessionFromYaml, + #[serde(default)] pub template: LayoutTemplate, #[serde(default)] pub borderless: bool, @@ -245,6 +247,20 @@ impl LayoutFromYaml { } } +// The struct that is used to deserialize the session from +// a yaml configuration file +#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)] +#[serde(crate = "self::serde")] +pub struct SessionFromYaml { + pub name: Option<String>, + #[serde(default = "default_as_some_true")] + pub attach: Option<bool>, +} + +fn default_as_some_true() -> Option<bool> { + Some(true) +} + // The struct that carries the information template that is used to // construct the layout #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] @@ -591,6 +607,7 @@ impl Default for LayoutTemplate { impl Default for LayoutFromYaml { fn default() -> Self { Self { + session: SessionFromYaml::default(), template: LayoutTemplate::default(), borderless: false, tabs: vec![], |