zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
19.42k stars 611 forks source link

Allow NewTab Action to specify the shell that will run #3385

Open giggio opened 1 month ago

giggio commented 1 month ago

Additionally to the current options to the NewTab command (cwd etc), I'd like to have the option to specify the shell that will run. Reason: I've been using Nushell for a while, but I still go back to Bash every now and then, and having a keyboard shortcut that allows me to quickly go there would be very helpful.

cristiand391 commented 1 month ago

you can create a new layout that runs bash like this: https://zellij.dev/documentation/creating-a-layout#command

both the CLI/keybind NewTab action take a layout.

related: zellij actually support overriding config in layouts: https://zellij.dev/documentation/layouts-with-config

so, you could set default_shell "nu" in the layout file, unfortunately this doesn't work with the new-tab action:

Note: These fields are ignored when loading a layout through the new-tab action

it does work if you create a new session and choose that layout, but I think setting a pane to run bash is easier for your use case.

giggio commented 1 month ago

I don't work a log with splits, I prefer to have my terminal fullscreen, so the layout solution wouldn't help me. I need a quick keyboard shortcut that opens a new tab on a different shell.

cristiand391 commented 1 month ago

I'm not sure I understand what you mean about splits.

Here's an example with layouts, my default shell is zsh but I can pass this layout to new-tab to start with bash:

Screencast from 05-28-2024 08:00:28 PM.webm

layout {
  pane size=1 borderless=true {
    plugin location="zj-status-bar"
  }
  pane command="bash"
}
zellij action new-tab --layout ~/.config/zellij/layouts/bash.kdl
cristiand391 commented 1 month ago

oh nvm, new panes will still open your default shell, maybe that's what you meant.

rather than having new-tab take a new param it might be better if config overriding would be supported like mentioned above.