zellij-org / zellij

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

[Feature] Make FocusOrCreateTab action available to User #2884

Open hakan-demirli opened 10 months ago

hakan-demirli commented 10 months ago

Currently FocusOrCreateTab action exists but I can not use it in my config.kdl. Can we make it available to user?

Why? I use tabs like workspaces in a desktop environment. I tap <win+1> It goes to workspace-1 etc. I can also achieve same thing in tmux using a bash script. I tap <alt+3> it goes to tab 3.

In both cases I do not need to create a workspace/tab. If it exists it switches to that one. If it does not it creates a new one.

In zellij I couldn't find a way to check wheter if the tab exists before creating a new one. Since, the names are not unique NewTab {name "tn";}is not sufficient. It just creates another tab with the same name.

Proposal Let the user use FocusOrCreateTab https://github.com/zellij-org/zellij/blob/35d93189e3638011883a931a96aea656dd125094/zellij-tile/src/shim.rs#L553-L554

image

hakan-demirli commented 6 months ago

zellij action go-to-tab-name "Tab #3" -c also achieves the same. However, this action is also not available in config.

hakan-demirli commented 6 months ago

Unfortunately, calling it via shortcut creates a new pane rather than switching tabs.

  bind "Alt 1" {
      Run "bash" "-c" "zellij action go-to-tab-name 'Tab #1' -c";
  }
theherk commented 1 month ago

Did you figure out a workaround for this? I'm looking for the same.

hakan-demirli commented 1 month ago

Unfortunately, I am still using Tmux. This is only one of the features available on Tmux but not Zellij. It will probably take a couple more years until Zellij becomes a viable Tmux replacement for my workflow.