wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.28k stars 781 forks source link

Save and load layouts #1949

Closed jakenvac closed 2 years ago

jakenvac commented 2 years ago

Is your feature request related to a problem? Please describe. I find it frustrating when I have to open up a terminal, configure my pane how I like them and run the relevant tools in each pane.

Describe the solution you'd like This suggestion is heavily inspired by layouts in zellij

I think it would be great to have some form of config file that can be loaded that will automatically configure pane/tabs and the commands that are run inside them. These could be saved inside of source control alongside projects.

For example if I'm frequently opening a text editor, file browser, and terminal in wezterm for editing code maybe it could be loaded by typing wz text-editor.yml or something.

configs could be made by hand or exported from an existing layout.

I would vote to use yaml for the config, however I'm aware toml is more idiomatic in rust applications. Maybe lua would be a good idea to be in keeping with the config file.

an example of what the config could look like if it were yaml. I'm absolutely positive this could be better thought out.

split:
  direction: vertical
  sections: 
    - split:
        direction: horizontal
      sections:
      - pane:
          cmd: 'br .'
          cwd: '.'
          width: '20%'
      - pane:
          cmd: 'nvim .'
    - pane:
        cmd: 'zsh'
        height: '10%'

Describe alternatives you've considered Remembering the last used layout by directory was an option I considered, but having editable configs would make it really nice to store specific layouts alongside projects.

Additional context I currently use zellij for this functionality however I really like the multiplexing in wezterm. Thanks for the great work!

wez commented 2 years ago

FWIW, when I think of layout, I think of window positioning rather than application composition. A layout feels like something that should be able to be applied or re-applied to make the arrangement conform to a pre-defined layout, rather than (in zellij's current implementation) an initial composition.

The "start up these apps in this arrangement" concept would fit wezterm better as an application startup event with a context parameter that allows setting up multiple windows, tabs and panes.

The "apply this layout to my existing set of windows/tabs/panes" concept (eg: like switching between tiling window modes in some window managers) is a bit different and requires the ability to influence the pane arrangement in a tab.

There's some plumbing needed for these concepts. I've linked some relevant issues below just so that it is easier for me to thread things together and close out the appropriate issues when things start to happen.

Related issues:

jakenvac commented 2 years ago

That sounds like a great solution to me. I'm happy to update the main issue to reflect that if you want to use it to keep track.

Thanks for the consideration and thanks for all your work on the project!

megalithic commented 2 years ago

So pumped about this feature!

jeot commented 2 years ago

I will be really excited if this happens! Forced to use windows OS, the wezterm was the closest thing to tmux that I experienced and pretty fast and neat too! Thanks.

It is so useful to be able to have a project-specific way that can set you up with your desired layout on project startup. (ex: 1 window, tabs & panes structure, editor/applications lunch in some panes and maybe run some commands).

One way I see that can happen is by project-specific's config file (something like vim sessions). Or even be able to source a config file after opening a new wezterm instance to run some actions.

tmux handles this differently with sessions and I can use https://github.com/tmux-plugins/tmux-resurrect plugin to have my sessions restored after a system restart. switching sessions is like switching projects.

Great work. Thanks.

wez commented 2 years ago

Nightly builds now support startup events; see https://github.com/wez/wezterm/issues/674#issuecomment-1159311125

wez commented 2 years ago

https://wezfurlong.org/wezterm/config/lua/gui-events/gui-startup.html is available in the current release

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.