Help using Windows Terminal as a windowing client (within WSL)

I’ve been trying to set up a workable kak installation on my work laptop, which unfortunately has to run Windows. tmux is extremely slow, and WSL has a few known rendering bugs which make tmux less than optimal for windowing. Windows Terminal allows for multiple panes and tabs, and it seems like if I could get this to work right, it would work decently well as a replacement for tmux. There are command line options for splitting the terminal and making new tabs with a command.

However, I can’t seem to get kakoune to connect to an existing session when splitting. This is the command:

cmd.exe /c wt.exe -w 0 sp --profile Ubuntu-20.04 bash -c "kak -c 12345"

When I run it (either from the shell itself or from within a kakoune command) I get:

connect to /tmp/kakoune/eric/12345 failed
disconnecting

The same does not happen if I run the same kakoune command from either bash or sh interactively. I’ve been able to run other commands, like “ping 1.1.1.1” or "kak " or whatever else, just fine within this terminal splitting command.

Is there something that’s required to read the session pipe that’s not quite ready at startup? Or maybe do I need to start bash differently?

This may seem a little basic, but does /tmp/kakoune/eric/12345 actually exist? More concretely, is $XDG_RUNTIME_DIR set differently between the two cases?

Hi geppettodivacin, mate if you do get this working can you please post the solution as this also interests me.

I just gave it a run on my wsl Ubuntu and no good either the UNC file path not supported and error 0x80070002 when launching was as far as I got.

Sorry buddy not much help but ill keep digging too, bye :wave:

@duncan Were you running the same command I was? I originally for the 0x80070002 error until I played around with the quoting. And do you get that error for other commands or just kak?

I’ll look at $XDG_RUNTIME_DIR when I sit down at my computer today, but I know that the file existed since I could connect to the session from starting kak within an existing terminal pane.

…I know that the file existed since I could connect to the session from starting kak within an existing terminal pane.

That doesn’t actually prove the file exists. $XDG_RUNTIME_DIR controls where Kakoune puts the session socket, so if it’s set differently (or completely missing) between the two environments, that would explain why they can’t find each other.

1 Like

Confirmed that the file does not exist, but also that in both the existing pane and the new pane $XDG_RUNTIME_DIR is empty.

The actual file is at /tmp/kakoune-eric/12345.

Apparently Kakoune changed its session directory on May 1st - versions of Kakoune built before that date put sessions in /tmp/kakoune/eric/12345, but versions of Kakoune after that date put sessions in /tmp/kakoune-eric/12345.

Is it possible that existing panes versus new panes execute a different kak binary? Is $PATH different between the two, for example?

EDIT: Ah, got it! :wink:

Upon more digging… it looks like I’ve got a separate global kakoune install, and it’s finding that one instead of the one in my ~/.local/bin. Probably a path error?

Same conclusion at the same time. :slight_smile:

The solution here was to make bash a login shell with the -l flag. Here’s the complete command for splitting the pane and connecting:

cmd.exe /c wt.exe -w 0 sp --profile Ubuntu-20.04 bash -c -l "kak -c 12345"

It works correctly as a kakoune :terminal command, as well. :tada:

2 Likes

Legend! :clap:

It also does ‘~’ expansion as well
cmd.exe /c wt.exe -w 0 sp --profile Ubuntu-20.04 bash -c -l "kak ~/.config/kak/kakrc"

cya.