It depends how kitty commands (like
kitty @ set-tab-title) figure out which kitty process to connect to. I’m not familiar with kitty, but I am familiar with tmux, so I’ll talk about that.
When tmux starts up, it creates a Unix-domain socket in a private location in the filesystem. When tmux launches a shell inside itself, it sets the
$TMUX environment variable to point at that socket. Since environment variables are inherited, any process the shell starts can read
$TMUX and talk to the the tmux session it’s running inside of (that’s actually how Kakoune detects whether to load the tmux plugin at all). For example, let’s say you’re running Kakoune inside tmux:
…and inside Kakoune (with the tmux plugin loaded) you run
:new. That winds up running
tmux new-window kak -c $kak_session so the new Kakoune client connects to the existing session. First Kakoune launches a new tmux process:
+- tmux new-window kak -c 1234
The new tmux process checks
$TMUX, connects to the session socket, and tells the session to launch a new window and run Kakoune inside it:
+- kak -c 1234
However, if the original Kakoune session was started outside tmux, it won’t have the
$TMUX environment variable, so there’s no way for
:new to figure out what tmux session the new window should be created in.
You might like to think about it this way: imagine you start a Kakoune session as a daemon, then connect to it from a client running inside tmux, and another client running inside Kitty. Then a hook (without user interaction) tries to run
:new - how can it know where the new client should be created?