Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Terminal profile not showing up

I've just installed WSL2 and am using the Windows Terminal on Win10 1909 (18363.1256). I'm trying to set up 2 different profiles, one that launches a local WSL2 Ubuntu shell, and one that launches another WSL2 shell that will automatically ssh to a specific host.

The local one works great, shows up without an issue, however I can't seem to get my 2nd profile to show up in the list of profiles.

My settings.json looks like this:

"profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
            "colorScheme": "One Half Dark",
            "fontFace": "JetbrainsMono NF",
            "fontSize": 11
        },
        "list":
        [
            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": "//wsl$/Ubuntu/home/sensanaty",
                "tabTitle": "WSL2"
            },
            {
                "guid": "{15c5814b-7ed1-4cec-bc64-d165274958fa}",
                "hidden": false,
                "name": "External Host",
                "source": "Windows.Terminal.Wsl",
                "commandline": "ssh [email protected]",
                "tabTitle": "External Host"
            },
        ]
    },

With the above, I only get the Ubuntu profile in my list

enter image description here

I thought maybe it was the guid generated or something, but I just did a simple uuidgen and pasted it into the json so it shouldn't really be causing any issues there. I've also obviously tried restarting my system, to no avail. The default profiles show up fine if I disable the option to stop auto-generating them, as well.

Any clue as to what might help me out?

like image 798
Sensanaty Avatar asked Oct 23 '25 10:10

Sensanaty


1 Answers

The 'source' attribute is for dynamically generated profiles, for which WSL will create one for each instance installed. You can't control the command line for these dynamically generated profiles. What you need is for your new profile to extend the command line to tell Terminal to use WSL. Remove the 'source' attribute entirely, so that your new profile is static.

In your case, that should be ...

            {
                "guid": "{15c5814b-7ed1-4cec-bc64-d165274958fa}",
                "hidden": false,
                "name": "External Host",
                //"source": "Windows.Terminal.Wsl",
                "commandline": "wsl.exe ssh [email protected]",
                "tabTitle": "External Host"
            }//, 

As bwolfbarn mentioned, you should also ditch that trailing comma if it really comes at the end of the "list" block.

Here are a few lines from mine as additional examples as well ...

            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu 20.04 WSL2 tmux",
                //"source": "Windows.Terminal.Wsl",
                "commandline": "wsl.exe -d Ubuntu -e sh -c \"/usr/bin/tmux has-session -t main 2>/dev/null && /usr/bin/tmux attach-session -d -t main || /usr/bin/tmux -2 new-session -t main -s main -c ${HOME}\"",
                "cursorShape": "filledBox"
            },
            {
                "guid": "{4e04fa7e-76c7-4746-a322-a227e70dde6c}",
                "hidden": false,
                "name": "Ubuntu 20.04 WSL1 tmux",
                //"commandline": "wsl.exe -d Ubuntu20.04_WSL1",
                "commandline": "wsl.exe -d Ubuntu20.04_WSL1 -e sh -c \"/usr/bin/tmux has-session -t main 2>/dev/null && /usr/bin/tmux attach-session -d -t main || /usr/bin/tmux -2 new-session -t main -s main -c ${HOME}\"",
                "cursorShape": "filledBox"
            }

Note that you could, I believe, use "wsl.exe -e" (a.k.a. --execute), but it's not really necessary in your case.

like image 75
NotTheDr01ds Avatar answered Oct 27 '25 01:10

NotTheDr01ds



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!