zellij icon indicating copy to clipboard operation
zellij copied to clipboard

[Feature] Make FocusOrCreateTab action available to User

Open hakan-demirli opened this issue 2 years ago • 4 comments
trafficstars

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 avatar Oct 20 '23 20:10 hakan-demirli

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

hakan-demirli avatar Feb 15 '24 23:02 hakan-demirli

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";
  }

hakan-demirli avatar Feb 15 '24 23:02 hakan-demirli

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

theherk avatar Jul 28 '24 17:07 theherk

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.

hakan-demirli avatar Jul 28 '24 17:07 hakan-demirli