From 08b1a72a7510ce9976379584a42a563800a93465 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Wed, 18 Mar 2026 12:54:07 +0200 Subject: [PATCH] Use `vs-pwsh` icons if applicable. --- .../TerminalSettingsModel/VsDevShellGenerator.cpp | 10 ++++++---- .../TerminalSettingsModel/VsDevShellGenerator.h | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/cascadia/TerminalSettingsModel/VsDevShellGenerator.cpp b/src/cascadia/TerminalSettingsModel/VsDevShellGenerator.cpp index ce145321071..69951664aba 100644 --- a/src/cascadia/TerminalSettingsModel/VsDevShellGenerator.cpp +++ b/src/cascadia/TerminalSettingsModel/VsDevShellGenerator.cpp @@ -21,9 +21,10 @@ void VsDevShellGenerator::GenerateProfiles(const VsSetupConfiguration::VsSetupIn const winrt::guid profileGuid{ ::Microsoft::Console::Utils::CreateV5Uuid(TERMINAL_PROFILE_NAMESPACE_GUID, std::as_bytes(std::span{ seed })) }; auto profile = winrt::make_self(profileGuid); profile->Name(winrt::hstring{ GetProfileName(instance) }); - profile->Commandline(winrt::hstring{ GetProfileCommandLine(instance) }); + bool isPwsh = false; + profile->Commandline(winrt::hstring{ GetProfileCommandLine(instance, isPwsh) }); profile->StartingDirectory(winrt::hstring{ instance.GetInstallationPath() }); - profile->Icon(winrt::hstring{ GetProfileIconPath() }); + profile->Icon(winrt::hstring{ GetProfileIconPath(isPwsh) }); profile->Hidden(hidden); profiles.emplace_back(std::move(profile)); } @@ -37,7 +38,7 @@ std::wstring VsDevShellGenerator::GetProfileName(const VsSetupConfiguration::VsS return name; } -std::wstring VsDevShellGenerator::GetProfileCommandLine(const VsSetupConfiguration::VsSetupInstance& instance) const +std::wstring VsDevShellGenerator::GetProfileCommandLine(const VsSetupConfiguration::VsSetupInstance& instance, bool& isPwsh) const { // Build this in stages, so reserve space now std::wstring commandLine; @@ -48,7 +49,8 @@ std::wstring VsDevShellGenerator::GetProfileCommandLine(const VsSetupConfigurati // We do need to allocate space for the full path even if we don't want to paste the whole thing in wchar_t pwshPath[MAX_PATH] = { 0 }; const auto pwshExeName = L"pwsh.exe"; - if (SearchPathW(nullptr, pwshExeName, nullptr, MAX_PATH, pwshPath, nullptr)) + isPwsh = SearchPathW(nullptr, pwshExeName, nullptr, MAX_PATH, pwshPath, nullptr); + if (isPwsh) { commandLine.append(pwshExeName); } diff --git a/src/cascadia/TerminalSettingsModel/VsDevShellGenerator.h b/src/cascadia/TerminalSettingsModel/VsDevShellGenerator.h index d8b54752c8d..f3c4846401d 100644 --- a/src/cascadia/TerminalSettingsModel/VsDevShellGenerator.h +++ b/src/cascadia/TerminalSettingsModel/VsDevShellGenerator.h @@ -37,13 +37,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model return L"VsDevShell" + instance.GetInstanceId(); } - std::wstring GetProfileIconPath() const + std::wstring GetProfileIconPath(bool isPwsh) const { - return L"ms-appx:///ProfileIcons/vs-powershell.png"; + return isPwsh ? L"ms-appx:///ProfileIcons/vs-pwsh.png" : + L"ms-appx:///ProfileIcons/vs-powershell.png"; } std::wstring GetProfileName(const VsSetupConfiguration::VsSetupInstance& instance) const; - std::wstring GetProfileCommandLine(const VsSetupConfiguration::VsSetupInstance& instance) const; + std::wstring GetProfileCommandLine(const VsSetupConfiguration::VsSetupInstance& instance, bool& isPwsh) const; std::wstring GetDevShellModulePath(const VsSetupConfiguration::VsSetupInstance& instance) const; }; };