wsl2-distro-manager
wsl2-distro-manager copied to clipboard
[FEATURE] Use Windows Terminal Dynamic Profiles to Start WSL
Is there an existing issue for this?
- [x] I have searched the existing issues
Problem?
Currently if you hit the "Start" (Triangular Play Button) button for any WSL instance it runs a wsl command that opens the default terminal. This is fine but it would be far more advantageous to use Windows Terminals Dynamic Profiles when launching so that Windows Terminal opens up using the correct settings and appearance. As it is every WSL instance just opens using the "Default" profile settings despite there being unique profiles for every WSL instance. This is caused by launching using the wsl command which has no way to set dynamic profiles.
https://learn.microsoft.com/en-us/windows/terminal/dynamic-profiles https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=windows
Here is an example of the resulting Default Windows Terminal
vs the expected
Solution
Edit the Start command so that it send a cmd command instead of a wsl command!
Something like this: (Used to fix Open Linux Here - Directory and Directory/Background Regkeys )
cmd.exe /c start wt -w 0 nt -p <profile-name> -d "%V"
or like this: (Used to fix Open Linux Here - Drive)
cmd.exe /c start wt -w 0 nt -p <profile-name> -d \.
I tried to do it myself in hopes of posting a PR but strangely enough changes to the wsl.dart start or startExplorer show no change in the use of wsl as the base command. I spent a little while poking around but I can't find what forcing it to start using C:\Windows\system32\wsl.exe
Alternatives
No response
Anything else?
No response