diff options
author | Jae-Heon Ji <32578710+jaeheonji@users.noreply.github.com> | 2022-02-01 02:19:21 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 02:19:21 +0900 |
commit | 1d2e303926fbf1b4b39507ae246e8557a4916e7b (patch) | |
tree | e0fef9ed587aeb86fead9a19e6f454872f080b06 /zellij-utils/src/input/layout.rs | |
parent | 1163189d6b999088cfb2d007ca398d94cfcd66d3 (diff) |
feat: add focus attribute in layout (#958)
* feat(layout): add focus attribute in layout
* feat: add state of focus to tab
* chore: i love clippy
* test(layout): update focus options
* feat: add focus pane
* feat: apply focus-pane when layout is only loaded
* change the instruction name for focus-on-tab
* chore: apply cargo-fmt
* test: add e2e testcase
Diffstat (limited to 'zellij-utils/src/input/layout.rs')
-rw-r--r-- | zellij-utils/src/input/layout.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index 9fa6709c2..d2125096e 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -140,6 +140,7 @@ pub struct Layout { pub run: Option<Run>, #[serde(default)] pub borderless: bool, + pub focus: Option<bool>, } // The struct that is used to deserialize the layout from @@ -421,6 +422,7 @@ pub struct LayoutTemplate { #[serde(default)] pub body: bool, pub split_size: Option<SplitSize>, + pub focus: Option<bool>, pub run: Option<RunFromYaml>, } @@ -466,6 +468,7 @@ pub struct TabLayout { pub split_size: Option<SplitSize>, #[serde(default)] pub name: String, + pub focus: Option<bool>, pub run: Option<RunFromYaml>, } @@ -712,6 +715,7 @@ impl TryFrom<TabLayout> for Layout { borderless: tab.borderless, parts: Self::from_vec_tab_layout(tab.parts)?, split_size: tab.split_size, + focus: tab.focus, run: tab.run.map(Run::try_from).transpose()?, }) } @@ -726,6 +730,7 @@ impl From<TabLayout> for LayoutTemplate { parts: Self::from_vec_tab_layout(tab.parts), body: false, split_size: tab.split_size, + focus: tab.focus, run: tab.run, } } @@ -741,6 +746,7 @@ impl TryFrom<LayoutTemplate> for Layout { borderless: template.borderless, parts: Self::from_vec_template_layout(template.parts)?, split_size: template.split_size, + focus: template.focus, run: template .run .map(Run::try_from) @@ -761,6 +767,7 @@ impl Default for TabLayout { run: None, name: String::new(), pane_name: None, + focus: None, } } } @@ -778,10 +785,12 @@ impl Default for LayoutTemplate { body: true, borderless: false, split_size: None, + focus: None, run: None, parts: vec![], }], split_size: None, + focus: None, run: None, } } |