summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/input/layout.rs
diff options
context:
space:
mode:
authorJae-Heon Ji <32578710+jaeheonji@users.noreply.github.com>2021-11-09 03:43:51 +0900
committerGitHub <noreply@github.com>2021-11-08 19:43:51 +0100
commit4838f0b52cdd0f8369b8842f6496efb949402250 (patch)
tree035270a14ef5a65a6e0b5df97e7fa7f7fdd648c7 /zellij-utils/src/input/layout.rs
parentb232326dc2b419467914f00a04e472e81379891f (diff)
feat: add initial session name to layout template (#789)
* feat: add session configuration to layout template WIP: prototyping for issue #611 * test(layout): add session name * feat(layout): add cond flow to check session name * feat(layout): update session * feat: add function to attach a session * fix(layout): update feedback * attach option only works when layout template exists. * feat(layout): add conditional for session-layout * update default attach value
Diffstat (limited to 'zellij-utils/src/input/layout.rs')
-rw-r--r--zellij-utils/src/input/layout.rs17
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![],