Getting a client's tty

I want to be able to write escape codes to the terminal to use kitty’s clipboard integration. I could potentially do this using echo -to-file /dev/tty but the problem is that commands are executed in the context of the server, which may not even be running inside a terminal.

My current solution is using the tty command outside Kakoune to get the specific file I need (like /dev/pts/0), but being able to do it inside kakoune would be nice. Any tips?

I currently have kitty configured for a single user session listening on a unix socket. This works well for me, and allows scripting from systemd and i3 or launchd and skhd and yabai.

A nice bit is that you can access the kitty window id from $client_env_KITTY_*

1 Like

And what do you do when you ssh to another machine?

EDIT: still, being able to access a clients tty would be very nice.

EDIT2: But actually, that gave me the idea of exporting a TTY variable in my .bashrc. I didn’t know about client_env_.

I guess I’ve never needed any of the “extra” functionality when ssh’d to another machine. The terminal escape codes and kittens still work, so I assume everything I do via ssh has a a terminal accessible.

Although right now, I have a separate kakoune session on each machine. I want to figure out how to merge them somehow, but have not figured out a decent way to do this. It would involve forwarding Kakoune’s session socket over ssh and having all sessions mount the same filesystems or something… hrmm