I am currently using yazi
as a TUI file manager, and one thing I wanted to do was set it up with my terminal emulator in a multi-pane view to have the file manager and a command line synchronized.
Essentially, if I move into a new directory in yazi
, the other pane, with another shell running, would also move to the new directory. If I wanted to open a file from yazi
, it would open in the other pane/shell.
I know I can write to a different shell using something like <command xyz> > /proc/<pid>/fd/1
, but it doesn't seem to let me actually execute the commands.
I know yazi
can spawn subshells, and I was thinking one possibility is to connect to the subshell in the other pane, but I'm really unsure of how to connect a terminal emulator to an existing shell. I use WezTerm, which can do multiplexing, but I don't think that would allow me to connect to the subshell, which has a valid PID and /dev/pts/<N>
EDIT: As requested, usage examples.
Scenario 1 - Navigating directories
In this example, as I move through directories in yazi
, the other pane will live update the PWD. So, if I default (in both) to ~
, then moving to documents
in yazi
will cause my prompt to go from ~
to ~/documents
, following the directory in yazi
. I don't expect the reverse to occur, where changing directories in the shell pane changes directories in yazi
, but changing them in yazi
would still, always change them in the shell pane
Scenario 2 - Editing files
In this example, when "opening" a file with a terminal application, like nano
, rather than replacing the yazi
TUI until I close nano
, nano
would open in the shell pane to facilitate editing there
Scenario 3 - Running commands requiring sudo
In this example, we see a limitation where yazi
doesn't do too well with commands that require the use of sudo
, so executing commands directly in the shell pane act as they typically would in a shell
mc
, as copied by very many TUI file managers. Either yazi can do the same, or you should be looking into extending it./proc/<pid>/fd/1
is for the shell (fish, for me), not the terminal emulator (WezTerm). It appears the output is going to stdout, as if the remote shell sent it, rather than stdin, but the terminal emulator PID isn't involved/proc/<pid>/fd/1
? If you check the shell's stdout then you get the shell's stdout, obviously. Most likely its stdin is also this same device,/dev/pts/<something>
. But if you write to it, you write to the terminal, not the shell's input. You ask me if I'm sure, well not only I am very sure, but also you yourself have clearly said that this is the behavior you're experiencing.