zellij icon indicating copy to clipboard operation
zellij copied to clipboard

Layout config discussion

Open raphCode opened this issue 2 years ago • 0 comments

The current layout system is a bit limited because it assumes hierarchical splits, whereas zellij layouts can be more flexible. This makes dumping an opened layout to file impossible in the general case. Here we can discuss on how to improve this.

My suggestion would be to specify layouts in a little ascii art drawing, like this:

AAB
CEB
CDD
XXX
Screenshot of the layout

image

Additional information can be optionally specified afterwards:
A:
  name: "Pane #6"
E:
  focus: true
X:
  plugin: "zellij:status-bar"
  height: 2

Split sizes are inferred from the drawing by default, but can also specified by some width / height parameters.

Example:

The following layouts should be identical:

AB

A:
  width: 33%
ABB

Reasons for not deriving the sizes from the drawings alone:

  • may lead to huge drawings or imprecise ratios otherwise (in the case of split fractions which can't be reduced, like 7/99 lines or columns, which gets more likely at small pane sizes)
  • varying split sizes is possible without having to redraw the layout
  • fixed size panes like some plugins must be specified anyways

Advantages:

  • intuitive, easy to see what approximate layout is created at a glance
  • can still be edited with a keyboard, not requiring unicode chars
  • no potentially unnecessary information, the current approach specifies split directions for panes that are not even split
  • extremely simple config for the most common use cases (low number of equal splits)

Drawbacks:

  • splitting some panes may require a redraw of the layout (e.g. splitting A horizontally)
  • complex layouts with a mix of inferred and specified sizes may be confusing or lead to unexpected results
  • limited to 26 panes (double that if we make it case sensitive)

raphCode avatar May 17 '22 12:05 raphCode