Skip to content

[FEATURE] Use Windows Terminal Dynamic Profiles to Start WSL #279

@Dracrius

Description

@Dracrius

Is there an existing issue for this?

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

Image

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

Image

vs the expected

Image

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

Image

Alternatives

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

featureFeature request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions