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

Add display name and icon to SUI extensions page #18633

Open
wants to merge 3 commits into
base: dev/cazamor/sui/extensions-page
Choose a base branch
from

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Feb 27, 2025

Summary of the Pull Request

Adds some polish to the Extensions page in the Settings UI. This includes:

  • For app extensions, extract the display name and icon from the extension package and display it in the UI
  • For dynamic profile generators, add a display name and icon and display it in the UI
  • If possible, prefer to use the display name for breadcrumbs other UI

References and Relevant Issues

Targets #18559

Detailed Description of the Pull Request / Additional comments

  • Settings Model Changes:
    • adds a DisplayName and Icon to IDynamicProfileGenerator
    • extract the DisplayName and Icon from app extensions and use them
    • ExtensionPackage is a new WinRT class to package a bunch of FragmentSettings together
  • Editor changes - view models:
    • Use ExtensionPackages rather than dynamically adding/removing FragmentSettings contents
    • Replace CurrentExtensionSource with CurrentExtensionPackage
  • Editor changes - views:
    • ExtensionPackageTemplateSelector is used to display ExtensionPackages with metadata vs simple ones that just have a source
    • improve accessibility names displayed and read out

Validation

✅ Keyboard navigation feels right
✅ Screen reader reads all info on screen properly
✅ Accessibility Insights FastPass found no issues
✅ "Discard changes" retains subpage, but removes any changes

@carlos-zamora
Copy link
Member Author

Demo

{AE427997-B029-4685-8E0F-3FE2761CFE2B}

{91C4546E-BBB8-42C6-B3EF-E6463E1DD9AA}


std::wstring_view PowershellCoreProfileGenerator::GetIcon() const noexcept
{
return POWERSHELL_ICON;
Copy link
Member Author

Choose a reason for hiding this comment

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

This icon doesn't look that great since I'm resizing it to make it bigger:
{960B37ED-8DD9-4979-938B-32E3232FD560}

Is there a better resource I can use here?


std::wstring_view WslDistroGenerator::GetIcon() const noexcept
{
return IconPath;
Copy link
Member Author

Choose a reason for hiding this comment

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

This icon doesn't look that great since I'm resizing it to make it bigger:
{15EA8CE4-6E3F-4DFD-8F19-2BE62347326A}

Is there a better resource I can use here?


std::wstring_view SshHostGenerator::GetIcon() const noexcept
{
return _getProfileIconPath();
Copy link
Member Author

Choose a reason for hiding this comment

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

Haven't tested this one since the generator is disabled by a feature flag, but I assume it doesn't look to great since I'm resizing. Same question as the others: is there a better resource I can use here?

@@ -28,6 +28,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model
public:
static std::wstring_view Namespace;
std::wstring_view GetNamespace() const noexcept override;
std::wstring_view GetDisplayName() const noexcept override;
std::wstring_view GetIcon() const noexcept override { return {}; };
Copy link
Member Author

Choose a reason for hiding this comment

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

The only icons I found here were one for PowerShell and one for CMD. Can we get a Visual Studio asset for here?

@@ -25,6 +25,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model
{
public:
std::wstring_view GetNamespace() const noexcept override;
std::wstring_view GetDisplayName() const noexcept override;
std::wstring_view GetIcon() const noexcept override { return {}; };
Copy link
Member Author

Choose a reason for hiding this comment

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

Surprised there's no icon here! Can we get one for Azure Cloud Shell?

Comment on lines +391 to +424
<!--
BODGY
Theoretically, you could use a ContentTemplateSelector directly. However, that doesn't work.
For some reason, we just get the object type's ToString called and the selector gets nullptr as a parameter.
Adding the template as a view model property is a workaround.
-->
Copy link
Member Author

Choose a reason for hiding this comment

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

📝 FYI, I spent like most of today figuring out how to work around this. Frustrating 😡

@@ -119,17 +119,19 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_extensionsVM = *extensionsVMImpl;
_extensionsViewModelChangedRevoker = _extensionsVM.PropertyChanged(winrt::auto_revoke, [=](auto&&, const PropertyChangedEventArgs& args) {
const auto settingName{ args.PropertyName() };
if (settingName == L"CurrentExtensionSource")
Copy link
Member Author

Choose a reason for hiding this comment

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

📝 All the changes in this file are really just because I switched from CurrentExtensionSource to CurrentExtensionPackage. Honestly, it's better this way imo. It aligns better with how the New Tab Menu works as well as the other subpages for profiles

@@ -42,7 +42,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
WINRT_OBSERVABLE_PROPERTY(Editor::NewTabMenuViewModel, ViewModel, _PropertyChangedHandlers, nullptr);

private:
Editor::NewTabMenuEntryTemplateSelector _entryTemplateSelector{ nullptr };
Copy link
Member Author

Choose a reason for hiding this comment

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

📝Drive by. We weren't using it at all.

@carlos-zamora
Copy link
Member Author

CC @nguyen-dows and @DHowett for some of the questions above. Y'all may know where I can find some of these assets

@carlos-zamora carlos-zamora force-pushed the dev/cazamor/sui/extensions-page branch from ec88b32 to 7cdbb7c Compare February 27, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant