Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain (and indicate) orphaned dynamic profiles #18188

Merged
merged 5 commits into from
Nov 15, 2024

Conversation

DHowett
Copy link
Member

@DHowett DHowett commented Nov 13, 2024

The original intent with dynamic profiles was that they could be uninstalled but that Terminal would remember your settings in case they ever came back.

After we implemented dynamic profile deletion, however, we accidentally made it so that saving your settings after a dynamic profile disappeared scoured it from the planet forever (since we remembered that we generated it, but now it was no longer in the settings file).

This pull request implements:

  • Tracking for orphaned dynamic profiles
  • A new settings page for the profile that explains what happened
  • Badging on the Navigation Menu indicating which profiles are orphaned and which are hidden

Closes #14061
Closes #11510
Refs #13916
Refs #9997

It looks like this:

image

If you disable all profile sources, it looks barren indeed:

image

@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-Settings Issues related to settings and customizability, for console or terminal Priority-2 A description (P2) Product-Terminal The new Windows Terminal. labels Nov 13, 2024
@DHowett
Copy link
Member Author

DHowett commented Nov 13, 2024

@zadjii-msft does this actually close #9997?

@@ -621,13 +630,33 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_Navigate(profileViewModel, BreadcrumbSubPage::None);
}

static MUX::Controls::InfoBadge _createGlyphIconBadge(wil::zwstring_view glyph)
{
MUX::Controls::InfoBadge badge;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW apparently you can give resources an x:Key look them up in the resource dictionary in the code side and then set them as the style programmatically.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no. AFAIK It still doesn't work for Theme Dictionaries - you need to look it up yourself in the final leaf node dictionary.


<local:SettingContainer x:Uid="Profile_Name">
<local:SettingContainer.Content>
<TextBlock FontFamily="Segoe UI, Segoe Fluent Icons, Segoe MDL2 Assets"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it need fluent icons?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, it's a convention we've used for all of our text fields - I suspect it's carried over from Icon, where we want to display MDL2 icons

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there's no free lunch. DirectWrite requires the creation of a custom font fallback collection for this to work, which is quite expensive. I suspect we cannot expect WinUI to be capable enough to cache such frequently used collection.
As such, I'd rather say we should change all the places that use them without having a reason to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will follow up with this then!

Comment on lines +651 to +658
if (profile.Orphaned())
{
profileNavItem.InfoBadge(_createGlyphIconBadge(L"\xE7BA") /* Warning Triangle */);
}
else if (profile.Hidden())
{
profileNavItem.InfoBadge(_createGlyphIconBadge(L"\xED1A") /* Hide */);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a tooltip and AutomationProperties.HelpText to profileNavItem to explain what these icons mean to the user? Screen readers won't even know the info badge is there!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WinUI already uses the tooltip for the profile name when it's too long. I can add a tooltip on the badge itself, and automation text, but narrator doesn't read it. Why is our UI framework bad?

@DHowett
Copy link
Member Author

DHowett commented Nov 15, 2024

Removed from body

It looks like this:

image

If you disable all profile sources, it looks barren indeed:

image

@DHowett DHowett merged commit 90866c7 into main Nov 15, 2024
20 checks passed
@DHowett DHowett deleted the dev/duhowett/orphaned-profiles branch November 15, 2024 17:02
DHowett added a commit that referenced this pull request Nov 16, 2024
The original intent with dynamic profiles was that they could be
uninstalled but that Terminal would remember your settings in case they
ever came back.

After we implemented dynamic profile _deletion_, however, we
accidentally made it so that saving your settings after a dynamic
profile disappeared scoured it from the planet _forever_ (since we
remembered that we generated it, but now it was no longer in the
settings file).

This pull request implements:

- Tracking for orphaned dynamic profiles

Closes #14061
Closes #11510
Refs #13916
Refs #9997

Modified for 1.22. I am not including any of the UI affordances.

(cherry picked from commit 90866c7)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgU1-p4
Service-Version: 1.22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Projects
Status: To Consider
Status: Rejected
3 participants