WSL import profile folders setting #21709

Closed
opened 2026-01-31 07:52:44 +00:00 by claunia · 3 comments
Owner

Originally created by @Firehawke on GitHub (May 13, 2024).

Description of the new feature/enhancement

Since Windows Terminal now supports setting up folders for profile groups, a setting to put WSL instances in a folder of your choice by default would be useful.

This came about when I started playing with nixos as a WSL2 instance; Windows Terminal found it by default as it should, but dumped it in the root folder so I'd have to edit the json to put it into the Linux folder where I keep my other WSL instances.

Proposed technical implementation details (optional)

A config setting in the JSON (and eventually in the UI as well, I know that's long-term as folders have almost no UI accessibility right now) to tell WT to put WSL2 imports in a specific folder by default. It's fine if the default starts off as the root as it is now; I can change it as needed after that point.

Originally created by @Firehawke on GitHub (May 13, 2024). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement Since Windows Terminal now supports setting up folders for profile groups, a setting to put WSL instances in a folder of your choice by default would be useful. This came about when I started playing with nixos as a WSL2 instance; Windows Terminal found it by default as it should, but dumped it in the root folder so I'd have to edit the json to put it into the Linux folder where I keep my other WSL instances. # Proposed technical implementation details (optional) A config setting in the JSON (and *eventually in the UI as well*, I know that's long-term as folders have almost no UI accessibility right now) to tell WT to put WSL2 imports in a specific folder by default. It's fine if the default starts off as the root as it is now; I can change it as needed after that point.
Author
Owner

@DHowett commented on GitHub (May 13, 2024):

Thanks for the request!
You can sort of do this already, by using a matchProfiles entry in the new tab menu (docs).

Here's what mine looks like:

"newTabMenu": 
[
    {
        "type": "remainingProfiles"
    },
    {
        "allowEmpty": false,
        "entries": 
        [
            {
                "commandline": null,
                "name": null,
                "source": "Windows.Terminal.Wsl",
                "type": "matchProfiles"
            }
        ],
        "icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
        "inline": "never",
        "name": "WSL",
        "type": "folder"
    }
],

In brief: it's two toplevel menu items, one that says "all unclaimed profiles go in the root" and one that says "now put some WSL profiles in a folder called WSL". All WSL profiles will go into the folder, and all non-WSL profiles will go into the root.

You can minimize it down to...

"newTabMenu": [
    { "type": "remainingProfiles" },
    {
        "entries": [ { "source": "Windows.Terminal.Wsl", "type": "matchProfiles" } ],
        "name": "WSL",
        "type": "folder"
    }
],

It looks like this at runtime (for me):

Image

(The ubuntu profile doesn't report as WSL, because Canonical Ltd created a new custom entry for it - you can use as many matchProfiles entries as you need in a menu, though, to cover everything you want.)

Does that help?

@DHowett commented on GitHub (May 13, 2024): Thanks for the request! You can sort of do this already, by using a `matchProfiles` entry in the new tab menu ([docs](https://learn.microsoft.com/en-us/windows/terminal/customize-settings/appearance#new-tab-dropdown)). Here's what mine looks like: ```json "newTabMenu": [ { "type": "remainingProfiles" }, { "allowEmpty": false, "entries": [ { "commandline": null, "name": null, "source": "Windows.Terminal.Wsl", "type": "matchProfiles" } ], "icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png", "inline": "never", "name": "WSL", "type": "folder" } ], ``` In brief: it's two toplevel menu items, one that says "all unclaimed profiles go in the root" and one that says "now put some WSL profiles in a folder called WSL". All WSL profiles will go into the folder, and all non-WSL profiles will go into the root. You can minimize it down to... ```json "newTabMenu": [ { "type": "remainingProfiles" }, { "entries": [ { "source": "Windows.Terminal.Wsl", "type": "matchProfiles" } ], "name": "WSL", "type": "folder" } ], ``` It looks like this at runtime (for me): ![Image](https://github.com/microsoft/terminal/assets/189190/2a3b4a42-3fae-4d8c-bfa1-7693b19d61e4) (The ubuntu profile doesn't report as WSL, because Canonical Ltd created a new custom entry for it - you can use as many `matchProfiles` entries as you need in a menu, though, to cover everything you want.) Does that help?
Author
Owner

@DHowett commented on GitHub (May 13, 2024):

FWIW, my actual new tab menu config looks like this:

Dustin's real new tab menu customization
"newTabMenu": 
[
    {
        "type": "remainingProfiles"
    },
    {
        "allowEmpty": false,
        "entries": 
        [
            {
                "commandline": null,
                "name": null,
                "source": "Windows.Terminal.PowershellCore",
                "type": "matchProfiles"
            }
        ],
        "icon": "ms-appx:///ProfileIcons/pwsh-preview.png",
        "inline": "never",
        "name": "PowerShell",
        "type": "folder"
    },
    {
        "allowEmpty": false,
        "entries": 
        [
            {
                "commandline": null,
                "name": null,
                "source": "Windows.Terminal.VisualStudio",
                "type": "matchProfiles"
            },
            {
                "profile": "{f795dd7e-af72-4ac5-befc-1676ae18cfb0}",
                "type": "profile"
            }
        ],
        "icon": "ms-appx:///ProfileIcons/pwsh-preview.png",
        "inline": "never",
        "name": "VS",
        "type": "folder"
    },
    {
        "allowEmpty": false,
        "entries": 
        [
            {
                "commandline": null,
                "name": null,
                "source": "Windows.Terminal.Wsl",
                "type": "matchProfiles"
            },
            {
                "commandline": null,
                "name": null,
                "source": "CanonicalGroupLimited.Ubuntu20.04LTS_79rhkp1fndgsc",
                "type": "matchProfiles"
            }
        ],
        "icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
        "inline": "never",
        "name": "WSL",
        "type": "folder"
    }
],

Image

@DHowett commented on GitHub (May 13, 2024): FWIW, my actual new tab menu config looks like this: <details> <summary>Dustin's real new tab menu customization</summary> ```json "newTabMenu": [ { "type": "remainingProfiles" }, { "allowEmpty": false, "entries": [ { "commandline": null, "name": null, "source": "Windows.Terminal.PowershellCore", "type": "matchProfiles" } ], "icon": "ms-appx:///ProfileIcons/pwsh-preview.png", "inline": "never", "name": "PowerShell", "type": "folder" }, { "allowEmpty": false, "entries": [ { "commandline": null, "name": null, "source": "Windows.Terminal.VisualStudio", "type": "matchProfiles" }, { "profile": "{f795dd7e-af72-4ac5-befc-1676ae18cfb0}", "type": "profile" } ], "icon": "ms-appx:///ProfileIcons/pwsh-preview.png", "inline": "never", "name": "VS", "type": "folder" }, { "allowEmpty": false, "entries": [ { "commandline": null, "name": null, "source": "Windows.Terminal.Wsl", "type": "matchProfiles" }, { "commandline": null, "name": null, "source": "CanonicalGroupLimited.Ubuntu20.04LTS_79rhkp1fndgsc", "type": "matchProfiles" } ], "icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png", "inline": "never", "name": "WSL", "type": "folder" } ], ``` ![Image](https://github.com/microsoft/terminal/assets/189190/33f38bf6-942d-4362-8f71-865e12f80ef7) </details>
Author
Owner

@Firehawke commented on GitHub (May 13, 2024):

At least for now that seems to be the best option we have. Thanks.

@Firehawke commented on GitHub (May 13, 2024): At least for now that seems to be the best option we have. Thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21709