From 5ede25dc37ceb192032524ac9200bb1ca95e5863 Mon Sep 17 00:00:00 2001 From: a-kenji Date: Fri, 9 Jul 2021 23:37:36 +0200 Subject: 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,] ``` --- zellij-utils/assets/config/default.yaml | 2 +- zellij-utils/assets/layouts/default.yaml | 2 ++ zellij-utils/assets/layouts/disable-status-bar.yaml | 2 ++ zellij-utils/assets/layouts/strider.yaml | 16 +++++++++------- 4 files changed, 14 insertions(+), 8 deletions(-) (limited to 'zellij-utils/assets') diff --git a/zellij-utils/assets/config/default.yaml b/zellij-utils/assets/config/default.yaml index d9090a8dc..e90b60a18 100644 --- a/zellij-utils/assets/config/default.yaml +++ b/zellij-utils/assets/config/default.yaml @@ -134,7 +134,7 @@ keybinds: key: [ Char: 'h', Left, Up, Char: 'k',] - action: [GoToNextTab,] key: [ Char: 'l', Right,Down, Char: 'j'] - - action: [NewTab,] + - action: [NewTab: ,] key: [ Char: 'n',] - action: [CloseTab,] key: [ Char: 'x',] diff --git a/zellij-utils/assets/layouts/default.yaml b/zellij-utils/assets/layouts/default.yaml index 96bf1809c..39dbdc1b0 100644 --- a/zellij-utils/assets/layouts/default.yaml +++ b/zellij-utils/assets/layouts/default.yaml @@ -7,6 +7,8 @@ parts: run: plugin: tab-bar - direction: Vertical + tabs: + - direction: Vertical - direction: Vertical split_size: Fixed: 2 diff --git a/zellij-utils/assets/layouts/disable-status-bar.yaml b/zellij-utils/assets/layouts/disable-status-bar.yaml index b990ba500..a0a592390 100644 --- a/zellij-utils/assets/layouts/disable-status-bar.yaml +++ b/zellij-utils/assets/layouts/disable-status-bar.yaml @@ -7,3 +7,5 @@ parts: run: plugin: tab-bar - direction: Vertical + tabs: + - direction: Vertical diff --git a/zellij-utils/assets/layouts/strider.yaml b/zellij-utils/assets/layouts/strider.yaml index 9bbe5772f..a39f327cf 100644 --- a/zellij-utils/assets/layouts/strider.yaml +++ b/zellij-utils/assets/layouts/strider.yaml @@ -7,13 +7,15 @@ parts: run: plugin: tab-bar - direction: Vertical - parts: - - direction: Horizontal - split_size: - Percent: 20 - run: - plugin: strider - - direction: Horizontal + tabs: + - direction: Vertical + parts: + - direction: Horizontal + split_size: + Percent: 20 + run: + plugin: strider + - direction: Horizontal - direction: Vertical split_size: Fixed: 2 -- cgit v1.2.3 From 88b4063879845cf53397f60201473ce386280cfe Mon Sep 17 00:00:00 2001 From: a-kenji Date: Sat, 21 Aug 2021 23:27:23 +0200 Subject: Add `template` section in `layout` file It works as follows: ``` --- template: direction: Horizontal parts: - direction: Vertical split_size: Fixed: 1 run: plugin: tab-bar - direction: Vertical body: true - direction: Vertical split_size: Fixed: 2 run: plugin: status-bar tabs: - direction: Vertical ``` The tabs are created in the body section of the template. --- zellij-utils/assets/layouts/default.yaml | 30 ++++++++------- .../assets/layouts/disable-status-bar.yaml | 20 +++++----- zellij-utils/assets/layouts/strider.yaml | 44 +++++++++++----------- 3 files changed, 49 insertions(+), 45 deletions(-) (limited to 'zellij-utils/assets') diff --git a/zellij-utils/assets/layouts/default.yaml b/zellij-utils/assets/layouts/default.yaml index 39dbdc1b0..c17cdd273 100644 --- a/zellij-utils/assets/layouts/default.yaml +++ b/zellij-utils/assets/layouts/default.yaml @@ -1,16 +1,18 @@ --- -direction: Horizontal -parts: +template: + direction: Horizontal + parts: + - direction: Vertical + split_size: + Fixed: 1 + run: + plugin: tab-bar + - direction: Vertical + body: true + - direction: Vertical + split_size: + Fixed: 2 + run: + plugin: status-bar +tabs: - direction: Vertical - split_size: - Fixed: 1 - run: - plugin: tab-bar - - direction: Vertical - tabs: - - direction: Vertical - - direction: Vertical - split_size: - Fixed: 2 - run: - plugin: status-bar diff --git a/zellij-utils/assets/layouts/disable-status-bar.yaml b/zellij-utils/assets/layouts/disable-status-bar.yaml index a0a592390..caa9f95ba 100644 --- a/zellij-utils/assets/layouts/disable-status-bar.yaml +++ b/zellij-utils/assets/layouts/disable-status-bar.yaml @@ -1,11 +1,11 @@ --- -direction: Horizontal -parts: - - direction: Vertical - split_size: - Fixed: 1 - run: - plugin: tab-bar - - direction: Vertical - tabs: - - direction: Vertical +template: + direction: Horizontal + parts: + - direction: Vertical + split_size: + Fixed: 1 + run: + plugin: tab-bar + - direction: Vertical + body: true diff --git a/zellij-utils/assets/layouts/strider.yaml b/zellij-utils/assets/layouts/strider.yaml index a39f327cf..c12b05779 100644 --- a/zellij-utils/assets/layouts/strider.yaml +++ b/zellij-utils/assets/layouts/strider.yaml @@ -1,23 +1,25 @@ --- -direction: Horizontal -parts: +template: + direction: Horizontal + parts: + - direction: Vertical + split_size: + Fixed: 1 + run: + plugin: tab-bar + - direction: Vertical + body: true + - direction: Vertical + split_size: + Fixed: 2 + run: + plugin: status-bar +tabs: - direction: Vertical - split_size: - Fixed: 1 - run: - plugin: tab-bar - - direction: Vertical - tabs: - - direction: Vertical - parts: - - direction: Horizontal - split_size: - Percent: 20 - run: - plugin: strider - - direction: Horizontal - - direction: Vertical - split_size: - Fixed: 2 - run: - plugin: status-bar + parts: + - direction: Horizontal + split_size: + Percent: 20 + run: + plugin: strider + - direction: Horizontal -- cgit v1.2.3