diff options
author | a-kenji <aks.kenji@protonmail.com> | 2021-07-09 23:37:36 +0200 |
---|---|---|
committer | a-kenji <aks.kenji@protonmail.com> | 2021-07-23 17:13:35 +0200 |
commit | 5ede25dc37ceb192032524ac9200bb1ca95e5863 (patch) | |
tree | 1b2a19f3110ca12ec8705dcb0c07502746c06ff5 /zellij-client/src | |
parent | 3df0210647e65170576f1ea97328cce26c211a43 (diff) |
Add `tabs` to `layouts`
fixes #603, fixes #349
* The layout has now a unique `tabs` section,
that can be used, like the `parts` section,
everything that is not inside the tabs section
is assumed to be present on every single tab
that is opened.
This is a BREAKING CHANGE for people that use
custom `layouts` already, since the `tabs` section
is not optional - for clarity and intentionality reasons.
The functionality to specify multiple tabs is already there,
but is still gated behind a panic, until #621 is fixed.
So for now one tab can be specified to load on startup.
* The `NewTab` action can optionally be bound to open
a layout that is assumed to be in the new `tabs` section
This is a BREAKING CHANGE for people that have the
`NewTab` action already bound in the config file:
```
- action: [NewTab, ]
key: [F: 5,]
```
must now be specified as:
```
- action: [NewTab: ,]
key: [F: 5,]
```
Optionally a layout that should be opened on the new tab can be
specified:
```
- action: [NewTab: {
direction: Vertical,
parts: [ {direction: Horizontal, split_size: {Percent: 50}}, {direction: Horizontal, run: {command: {cmd: "htop"}}},],
key: [F: 6,]
```
or:
```
- action: [NewTab: {direction: Vertical, run: {command: {cmd: "htop"} }},]
key: [F: 7,]
```
or
```
- action: [NewTab: {
direction: Vertical,
parts: [ {direction: Vertical, split_size: {Percent: 25},run: {plugin: "strider" }}, {direction: Horizontal}],}, MoveFocus: Left,]
key: [F: 8,]
```
Diffstat (limited to 'zellij-client/src')
-rw-r--r-- | zellij-client/src/input_handler.rs | 2 | ||||
-rw-r--r-- | zellij-client/src/lib.rs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/zellij-client/src/input_handler.rs b/zellij-client/src/input_handler.rs index f02b5ad81..19b0f6291 100644 --- a/zellij-client/src/input_handler.rs +++ b/zellij-client/src/input_handler.rs @@ -183,7 +183,7 @@ impl InputHandler { } Action::CloseFocus | Action::NewPane(_) - | Action::NewTab + | Action::NewTab(_) | Action::GoToNextTab | Action::GoToPreviousTab | Action::CloseTab diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index 2bfaae2e8..8bb595bc7 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -18,7 +18,7 @@ use zellij_utils::{ channels::{self, ChannelWithContext, SenderWithContext}, consts::{SESSION_NAME, ZELLIJ_IPC_PIPE}, errors::{ClientContext, ContextType, ErrorInstruction}, - input::{actions::Action, config::Config, layout::Layout, options::Options}, + input::{actions::Action, config::Config, layout::MainLayout, options::Options}, ipc::{ClientAttributes, ClientToServerMsg, ExitReason, ServerToClientMsg}, }; @@ -86,7 +86,7 @@ pub fn start_client( opts: CliArgs, config: Config, info: ClientInfo, - layout: Option<Layout>, + layout: Option<MainLayout>, ) { let clear_client_terminal_attributes = "\u{1b}[?1l\u{1b}=\u{1b}[r\u{1b}12l\u{1b}[?1000l\u{1b}[?1002l\u{1b}[?1003l\u{1b}[?1005l\u{1b}[?1006l\u{1b}[?12l"; let take_snapshot = "\u{1b}[?1049h"; |