zellij icon indicating copy to clipboard operation
zellij copied to clipboard

Feature: apply layout at runtime

Open imsnif opened this issue 4 years ago • 7 comments

We should be able to allow defining several possible layouts in the layout yaml file: https://zellij.dev/documentation/layouts.html

We should then have some keyboard shortcut that would switch between these layouts, provided that the same amount of panes are open on screen (it would rearrange the open panes to fit the new layout alternate).

imsnif avatar Sep 25 '21 15:09 imsnif

I'll work on this over the weekend if no one else has taken this up yet. It looks like I need to:

  1. Modify the layout file to accept multiple "template" layouts
  2. Add Action::NextLayout / Action::PreviousLayout variants and bind keys to them
  3. Add ScreenInstruction::NextLayout / ScreenInstruction::PreviousLayout variants to be called from the router.
  4. Add an update_layout method to both the screen and tab to handle resizing and re-rendering panes.
  5. (Possibly) Add a layouts mode in the status bar to surface the keybindings to the user. I'm not sure if this is necessary.

Does that all sounds about right?

spacemaison avatar Oct 02 '21 07:10 spacemaison

Sounds good to me!

imsnif avatar Oct 04 '21 15:10 imsnif

I think it could also be useful to "add" a new layout to current session, opening more tabs as required by the new layout.

This would fit my workflow because I only keep a single terminal window with zellij open at all times, for weeks: When I want to work on e.g. zellij, I could just open a prepared layout that adds a new Tab with panes running vim, cargo watch, and some shell for git commands while leaving all previously opened Tabs/Panes intact.

I was just notified that for single Tabs, the functionality already exists: https://zellij.dev/documentation/keybindings-actions.html#newtab-tablayout

raphCode avatar May 13 '22 11:05 raphCode

Would love to be able to do this, specifically so I can switch back and forth to the compact-bar at will.

The interface is excellent and very friendly for new users, but once you learn the commands it feels a bit needlessly busy.

I'm at a sort of middle ground, where I can get by on memory most of the time, but still need to reference things once in a while. It would be great if I could start off with the compact bar, but be able to switch to a layout containing the full default status bar on-the-fly using a keyboard shortcut in the instances where I need it.

Edit: I just noticed https://github.com/zellij-org/zellij/issues/1400 exists for this very use case... sorry for the noise, I guess it's already on the roadmap.

mikegreiling avatar Apr 26 '24 16:04 mikegreiling

Check out zellij-forgot.

imsnif avatar Apr 26 '24 16:04 imsnif

Check out zellij-forgot.

Oh, that is perfect. Thank you 🙏

mikegreiling avatar Apr 26 '24 16:04 mikegreiling