zellij-org / zellij

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

Add focus-pane-with-id CLI action #3747

Open topisani opened 2 weeks ago

topisani commented 2 weeks ago

Allows scripts to better control the pane focus. My use case is to avoid this horrible hack used in the kakoune zellij integration: https://github.com/mawww/kakoune/blob/8c49c8ee404fecc110338c08eeed515b63caa93c/rc/windowing/zellij.kak#L46-L59

Instead, a pane can now be focused from its $ZELLIJ_PANE_ID environment variable. Possibly a fix for https://github.com/zellij-org/zellij/issues/3190

imsnif commented 2 weeks ago

Hey, I appreciate you putting the time into this but I'm afraid in Zellij-world we encourage users to perform such actions with plugins.

As you have discovered, the CLI is not aware of multiple clients and can never be (because multiple clients being focused on the terminal is a Zellij concept). Meaning that when there is more than one client connected to the session, the results of this action will be unexpected to all users involved.

Plugins are client aware. It's possible to write a plugin that does this and then load it into Zellij, have it communicate with kakoune and generally do the right thing.

Thank you for your understanding.