visual-studio-codezshwindows-subsystem-for-linuxtmux

Running the `code` command creates two new windows on wsl + tmux


I am new to Tmux , and I am trying to configure it with my WSL instance.

This is the initial setup so far: enter image description here

but when I want to open a directory into vscode, without tmux I would run code . and vscode would open the current directory as the folder. Now with Tmux what happens is: VSCode launches the current dir as the folder but also two new windows pop up in tmux, one that has the path for vscode as the cwd and one that is has the directory that I opened vscode from as the cwd.

All windows pictured bellow:

Initial window invoking vscode: enter image description here

New window with vscode's path as cwd: enter image description here

New window with the same cwd as the initial invoker of code .: enter image description here

And the vscode app with the cwd of bin: enter image description here

I have observed that these two new windows only appear if vscode isn't currently running.

I don't know if this is a tmux, wsl, zsh, p10k, oh-my-zsh, vscode or anyother program's issue.


Solution

  • The problem and solution was:

    In my .zshrc file i had a stanza to open tmux on terminal creation,

    if [ "$TMUX" = "" ]; then exec tmuxn; fi

    removing this was the solution.