Wrong icon and title when starting wt from command line #8114

Closed
opened 2026-01-31 01:21:05 +00:00 by claunia · 5 comments
Owner

Originally created by @0ric1 on GitHub (May 13, 2020).

Environment

Windows 10 1909 / Windows Terminal 0.11.1191.0 / wsl Ubuntu 19.10

Steps to reproduce

  1. Open a cmd prompt
  2. wt -d .. wsl.exe --distribution Ubuntu
  3. wt -p "Ubuntu"

Expected behavior

In both cases the same icon (Ubuntu) and title "Ubuntu 19.10 (latest)" should be displayed in the tab - same as if windows terminal is started by clicking onto the icon and by selecting the profile from the configuration list. The settings.json contains:
"name": "Ubuntu 19.10 (latest)", for this "Ubuntu" distribution.

Actual behavior

  1. Linux penguin and Ubuntu is displayed in the tab of wt - the penguin is wrong
  2. Powershell icon and "PowerShell 7" is displayed in the title - both are wrong

In both cases Ubuntu 19.10 is started, lsb_release -a shows Description: Ubuntu 19.10
In the 1. case the command prompt displays missing characters:  /  mnt , in the 2. case the command prompt is fine:
2020_WindowsTerminalCharacterProblems

Thanks for the help

Originally created by @0ric1 on GitHub (May 13, 2020). # Environment Windows 10 1909 / Windows Terminal 0.11.1191.0 / wsl Ubuntu 19.10 # Steps to reproduce 1. Open a cmd prompt 2. `wt -d .. wsl.exe --distribution Ubuntu` 3. `wt -p "Ubuntu"` # Expected behavior In both cases the same icon (Ubuntu) and title "Ubuntu 19.10 (latest)" should be displayed in the tab - same as if windows terminal is started by clicking onto the icon and by selecting the profile from the configuration list. The settings.json contains: `"name": "Ubuntu 19.10 (latest)",` for this "Ubuntu" distribution. # Actual behavior 1. Linux penguin and Ubuntu is displayed in the tab of wt - the penguin is wrong 2. Powershell icon and "PowerShell 7" is displayed in the title - both are wrong In both cases Ubuntu 19.10 is started, `lsb_release -a` shows `Description: Ubuntu 19.10` In the 1. case the command prompt displays missing characters: ` /  mnt `, in the 2. case the command prompt is fine: ![2020_WindowsTerminalCharacterProblems](https://user-images.githubusercontent.com/309430/81856649-68276500-9561-11ea-91a3-435f05667774.PNG) Thanks for the help
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 01:21:06 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (May 13, 2020):

wt wsl.exe starts WSL using your default profile. This is by design.

@DHowett-MSFT commented on GitHub (May 13, 2020): `wt wsl.exe` starts WSL using your default profile. This is by design.
Author
Owner

@0ric1 commented on GitHub (May 13, 2020):

My wsl.exe default profile is Legacy - that is Ubuntu 16.04 that is stared when I call it with
wt -d . wsl.exe --distribution Legacy
If I call wt -d . wsl.exe --distribution Ubuntu-18.04
it starts Ubuntu 18.04 LTS - also with the wrong icon and title.

@0ric1 commented on GitHub (May 13, 2020): My wsl.exe default profile is Legacy - that is Ubuntu 16.04 that is stared when I call it with `wt -d . wsl.exe --distribution Legacy` If I call `wt -d . wsl.exe --distribution Ubuntu-18.04` it starts Ubuntu 18.04 LTS - also with the wrong icon and title.
Author
Owner

@DHowett-MSFT commented on GitHub (May 13, 2020):

So, there's two things at play here.

1. Windows Terminal "Profiles"

A "profile" is a collection of settings--font, colors, appearance configuration (background image, opacity, acrylic, cursor style, etc.), starting directory--coupled with a "commandline". The commandline is the application spawned by default for that profile.

2. WSL Distributions

A distribution is a linux userland spawned through WSL.

Terminal automatically detects each of these and makes a profile for it. That profile's "commandline" automatically spawns that WSL distribution.


Now, that "commandline" is only used when the profile is spawned normally. Through the menu, or through wt -p "ProfileName".

As you know, you have a default profile. That's the one that gets launched when you click the [+] button on its own, or when you launch Terminal directly.

If you use wt file.exe, you are setting the commandline. You are not changing the profile.

This means that your default profile is getting launched, as though you had written this:

"name": "PowerShell",
"commandline": "wsl.exe",
"colorScheme": "PowerShell"

When you add -d Distribution, you're not really changing the profile in use. You're changing (2), the distribution.

It's like you're doing this:

"name": "PowerShell",
"commandline": "wsl.exe -d Distribution",  // <----- See, it went here
"colorScheme": "PowerShell"

If you want to choose a different set of configuration flags (number 1 above), you have to pass -p with the name of the profile.

@DHowett-MSFT commented on GitHub (May 13, 2020): So, there's two things at play here. ## 1. Windows Terminal "Profiles" A "profile" is a collection of settings--font, colors, appearance configuration (background image, opacity, acrylic, cursor style, etc.), starting directory--coupled with a "commandline". The commandline is the application spawned _by default_ for that profile. ## 2. WSL Distributions A distribution is a linux userland spawned through WSL. Terminal automatically detects each of these and makes a _profile_ for it. That profile's "commandline" automatically spawns that WSL distribution. --- Now, that "commandline" is only used when the profile is spawned normally. Through the menu, or through `wt -p "ProfileName"`. As you know, you have a default profile. That's the one that gets launched when you click the [+] button on its own, or when you launch Terminal directly. If you use `wt file.exe`, you are setting the _commandline_. You are **not** changing the profile. This means that your default profile is getting launched, as though you had written this: ``` "name": "PowerShell", "commandline": "wsl.exe", "colorScheme": "PowerShell" ``` When you add `-d Distribution`, you're not really changing the _profile_ in use. You're changing (2), the distribution. It's like you're doing this: ``` "name": "PowerShell", "commandline": "wsl.exe -d Distribution", // <----- See, it went here "colorScheme": "PowerShell" ``` If you want to choose a different _set of configuration flags_ (number 1 above), you have to pass `-p` with the name of the profile.
Author
Owner

@0ric1 commented on GitHub (May 14, 2020):

Aha, I understand, so I can start a terminal with two tabs with:
wt -p "Ubuntu"; new-tab -p "cmd"
that works fine - stays open, but when I execute wt -p "Ubuntu" ls -al; new-tab -p "cmd" dir
the terminal is started with the two tabs and the commands dir and ls are executed but then the terminal is closed automatically. What must I do to let the terminal stay open after executing the commands?

@0ric1 commented on GitHub (May 14, 2020): Aha, I understand, so I can start a terminal with two tabs with: `wt -p "Ubuntu"; new-tab -p "cmd"` that works fine - stays open, but when I execute `wt -p "Ubuntu" ls -al; new-tab -p "cmd" dir` the terminal is started with the two tabs and the commands dir and ls are executed but then the terminal is closed automatically. What must I do to let the terminal stay open after executing the commands?
Author
Owner

@DHowett-MSFT commented on GitHub (May 15, 2020):

It's not really designed for that. If you want to keep the window open always, set the closeOnExit profile setting to never 😄

@DHowett-MSFT commented on GitHub (May 15, 2020): It's not really designed for that. If you want to keep the window open _always_, set the `closeOnExit` profile setting to `never` :smile:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8114