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-server/src/lib.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-server/src/lib.rs')
-rw-r--r-- | zellij-server/src/lib.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 96b7e7fa0..3f7ac9898 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -313,9 +313,25 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { }; if !&layout.tabs.is_empty() { - for tab_layout in layout.tabs { + for tab_layout in layout.clone().tabs { spawn_tabs(Some(tab_layout.clone())); } + + let focused_tab = layout + .tabs + .into_iter() + .enumerate() + .find(|(_, tab_layout)| tab_layout.focus.unwrap_or(false)); + if let Some((tab_index, _)) = focused_tab { + session_data + .read() + .unwrap() + .as_ref() + .unwrap() + .senders + .send_to_pty(PtyInstruction::GoToTab((tab_index + 1) as u32, client_id)) + .unwrap(); + } } else { spawn_tabs(None); } |