the tab title after launching powershell (launches terminal I think) doesn't make sense... "app data"??? #16876

Open
opened 2026-01-31 05:25:51 +00:00 by claunia · 5 comments
Owner

Originally created by @zadjii-msft on GitHub (Feb 25, 2022).

From MSFT:38253775

When launching pwsh From the Start Menu with defterm enabled, the title is set to the full path to the shortcut, rather than "PowerShell 7" (or whatever"

image

idle thought: might be because conpty doesn't load ANY settings when we start it. In this case thought, the title is a setting that's in the lnk.

Unclear if this is something we could fix Terminal side. IDK if we know the lnk when we get an inbound connection.

Originally created by @zadjii-msft on GitHub (Feb 25, 2022). From MSFT:38253775 When launching pwsh From the Start Menu with defterm enabled, the title is set to the full path to the shortcut, rather than "PowerShell 7" (or whatever" ![image](https://user-images.githubusercontent.com/18356694/155758395-150af0a6-3902-4f64-8163-19654152e803.png) idle thought: might be because conpty doesn't load ANY settings when we start it. In this case thought, the _title_ is a setting that's in the lnk. Unclear if this is something we could fix Terminal side. IDK if we know the lnk when we get an inbound connection.
Author
Owner

@lhecker commented on GitHub (Feb 25, 2022):

My theory is that this code:
53a454fbd3/src/renderer/base/RenderEngineBase.cpp (L29)

is supposed to be:

if (_titleChanged)

This would match how GdiEngine works, as it assumes it only needs to render if _titleChanged is true.
See OpenConsole!2043946 where a review comment implies that this was actually always supposed to use _titleChanged.

@lhecker commented on GitHub (Feb 25, 2022): My theory is that this code: https://github.com/microsoft/terminal/blob/53a454fbd3e2992be5c1f2c8ed9e2c2974f0e7b8/src/renderer/base/RenderEngineBase.cpp#L29 is supposed to be: ```cpp if (_titleChanged) ``` This would match how GdiEngine works, as it assumes it only needs to render if `_titleChanged` is `true`. See OpenConsole!2043946 where a review comment implies that this was actually always supposed to use `_titleChanged`.
Author
Owner

@DHowett commented on GitHub (Feb 25, 2022):

I suspect that changing the condition there will result in us simply not sending the title in the first frame ... because _titleChanged defaults to false.

Conhost is supposed to send its initial title in the first frame... we just need to make sure that the initial title is correct. I feel like the root of the problem is likely to be in accepting a handoff of a connection packet. srvinit.cpp:408 et al processes the new incoming connection packet from inbox conhost.

@DHowett commented on GitHub (Feb 25, 2022): I suspect that changing the condition there will result in us simply _not sending the title in the first frame_ ... because `_titleChanged` defaults to `false`. Conhost is _supposed_ to send its initial title in the first frame... we just need to make sure that the initial title is correct. I feel like the root of the problem is likely to be in accepting a handoff of a connection packet. srvinit.cpp:408 et al processes the new incoming connection packet from inbox conhost.
Author
Owner

@DHowett commented on GitHub (Feb 25, 2022):

Notes from a discussion: GDI doesn't paint the first title change to the HWND because the window is created with a title already (window.cpp:308)

@DHowett commented on GitHub (Feb 25, 2022): Notes from a discussion: GDI doesn't paint the first title change to the HWND because the window is _created_ with a title already (window.cpp:308)
Author
Owner

@DHowett commented on GitHub (Feb 25, 2022):

SetUpConsole calls GetSettingsFromLink, which uses s_GetLinkValues, which handles STARTF_TITLEISLNKNAME. using s_GetLinkTitle.

SetUpConsole only calls GetSettingsFromLink if it is not in ConPTY mode.

Effectively, it is ignoring the whole lnk (like it is supposed to), but in so doing it is also ignoring the link filename as the title

@DHowett commented on GitHub (Feb 25, 2022): > `SetUpConsole` calls `GetSettingsFromLink`, which uses `s_GetLinkValues`, which handles `STARTF_TITLEISLNKNAME`. using `s_GetLinkTitle`. > > `SetUpConsole` only calls `GetSettingsFromLink` if it is not in ConPTY mode. > > Effectively, it is ignoring the *whole* lnk (like it is supposed to), but in so doing it is also ignoring the link filename as the title
Author
Owner

@DHowett commented on GitHub (Feb 25, 2022):

This suggests that it can be fixed in OpenConsole.exe during bringup, but I am not sure how.

We should actually try to propagate both the EXE and LNK paths to Terminal in the future, but FOR TODAY it is not necessary for Terminal to know about the LNK.

@DHowett commented on GitHub (Feb 25, 2022): This suggests that it can be fixed in OpenConsole.exe during bringup, but I am not sure how. We should actually try to propagate both the EXE _and LNK_ paths to Terminal in the future, but FOR TODAY it is not necessary for Terminal to know about the LNK.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16876