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

**URL:** <https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842>\
**Category:** Help\
**Tags:** windows, terminal\
**Created:** [August 20, 2021, 4:40pm UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842 "2021-08-20T16:40:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![geppettodivacin](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/geppettodivacin/32/971_2.png) [@geppettodivacin](https://discuss.kakoune.com/u/geppettodivacin)\
**Post date:** [August 20, 2021, 4:40pm UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/1 "2021-08-20T16:40:26Z")

</div>

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:

```auto
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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [August 21, 2021, 1:22am UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/2 "2021-08-21T01:22:25Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![duncan](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/duncan/32/95_2.png) [@duncan](https://discuss.kakoune.com/u/duncan)\
**Post date:** [August 21, 2021, 12:46pm UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/3 "2021-08-21T12:46:03Z")

</div>

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 👋

---

<div class="post-metadata">

**Author:** ![geppettodivacin](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/geppettodivacin/32/971_2.png) [@geppettodivacin](https://discuss.kakoune.com/u/geppettodivacin)\
**Post date:** [August 21, 2021, 1:33pm UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/4 "2021-08-21T13:33:41Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [August 21, 2021, 2:22pm UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/5 "2021-08-21T14:22:26Z")

</div>

> …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.

---

<div class="post-metadata">

**Author:** ![geppettodivacin](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/geppettodivacin/32/971_2.png) [@geppettodivacin](https://discuss.kakoune.com/u/geppettodivacin)\
**Post date:** [August 21, 2021, 2:32pm UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/6 "2021-08-21T14:32:32Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [August 21, 2021, 2:53pm UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/7 "2021-08-21T14:53:31Z")

</div>

Apparently [Kakoune changed its session directory](https://github.com/mawww/kakoune/commit/db9ef82398a08bdf985ff26bfb230fb0cd1221a5#diff-3864afade279f9880384d34a2958e2f861f39dcc0d6e4a176cbcaff71365069d) 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! 😉

---

<div class="post-metadata">

**Author:** ![geppettodivacin](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/geppettodivacin/32/971_2.png) [@geppettodivacin](https://discuss.kakoune.com/u/geppettodivacin)\
**Post date:** [August 21, 2021, 2:53pm UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/8 "2021-08-21T14:53:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![geppettodivacin](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/geppettodivacin/32/971_2.png) [@geppettodivacin](https://discuss.kakoune.com/u/geppettodivacin)\
**Post date:** [August 21, 2021, 2:54pm UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/9 "2021-08-21T14:54:05Z")

</div>

Same conclusion at the same time. 🙂

---

<div class="post-metadata">

**Author:** ![geppettodivacin](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/geppettodivacin/32/971_2.png) [@geppettodivacin](https://discuss.kakoune.com/u/geppettodivacin)\
**Post date:** [August 21, 2021, 3:03pm UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/10 "2021-08-21T15:03:11Z")

</div>

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:

```auto
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. 🎉

---

<div class="post-metadata">

**Author:** ![duncan](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/duncan/32/95_2.png) [@duncan](https://discuss.kakoune.com/u/duncan)\
**Post date:** [August 24, 2021, 11:14am UTC](https://discuss.kakoune.com/t/help-using-windows-terminal-as-a-windowing-client-within-wsl/1842/11 "2021-08-24T11:14:49Z")

</div>

> [@geppettodivacin](#):
>
> The solution

Legend! 👏

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.
