From a50eba1cc9325d811660bfbfb8f9e47d04443993 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Wed, 20 Mar 2024 17:23:11 -0400 Subject: [PATCH] Remove the "set default terminal" banner (#16873) **Default Terminal**: Everyone who cares to know, knows. Everyone who doesn't, has an annoying bar above all terminals I had to introduce a workaround for the fact that unknown dismissed message keys in `state.json` result in Terminal exploding on launch. :grin: That's tracked in #16874. Closes #11930 (but not in the way you'd expect) (cherry picked from commit febfbebf9b2966590633b0c67776d0750b1ae8d1) Service-Card-Id: 92139784 Service-Version: 1.20 --- .../Resources/en-US/Resources.resw | 7 -- src/cascadia/TerminalApp/TerminalPage.cpp | 68 ------------------- src/cascadia/TerminalApp/TerminalPage.h | 3 - src/cascadia/TerminalApp/TerminalPage.xaml | 15 ---- .../ApplicationState.idl | 5 +- .../TerminalSettingsSerializationHelpers.h | 7 +- 6 files changed, 8 insertions(+), 97 deletions(-) diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw index 3ad4bdb73b8..3f91408815f 100644 --- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw @@ -771,19 +771,12 @@ Termination behavior can be configured in advanced profile settings. - - Windows Terminal can be set as the default terminal application in your settings. - Don't show again This Terminal window is running as Admin - - Open Settings - This is a call-to-action hyperlink; it will open the settings. - Suggestions found: {0} {0} will be replaced with a number. diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index b350fed479d..efc802cc20d 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -283,8 +283,6 @@ namespace winrt::TerminalApp::implementation _defaultPointerCursor = CoreWindow::GetForCurrentThread().PointerCursor(); } CATCH_LOG(); - - ShowSetAsDefaultInfoBar(); } Windows::UI::Xaml::Automation::Peers::AutomationPeer TerminalPage::OnCreateAutomationPeer() @@ -3868,9 +3866,6 @@ namespace winrt::TerminalApp::implementation // Request a summon of this window to the foreground _SummonWindowRequestedHandlers(*this, nullptr); - const IInspectable unused{ nullptr }; - _SetAsDefaultDismissHandler(unused, unused); - // TEMPORARY SOLUTION // If the connection has requested for the window to be maximized, // manually maximize it here. Ideally, we should be _initializing_ @@ -4052,35 +4047,6 @@ namespace winrt::TerminalApp::implementation } } - // Method Description: - // - Displays a info popup guiding the user into setting their default terminal. - void TerminalPage::ShowSetAsDefaultInfoBar() const - { - if (::winrt::Windows::UI::Xaml::Application::Current().try_as<::winrt::TerminalApp::App>() == nullptr) - { - // Just ignore this in the tests (where the Application::Current() - // is not a TerminalApp::App) - return; - } - if (!CascadiaSettings::IsDefaultTerminalAvailable() || _IsMessageDismissed(InfoBarMessage::SetAsDefault)) - { - return; - } - - // If the user has already configured any terminal for hand-off we - // shouldn't inform them again about the possibility to do so. - if (CascadiaSettings::IsDefaultTerminalSet()) - { - _DismissMessage(InfoBarMessage::SetAsDefault); - return; - } - - if (const auto infoBar = FindName(L"SetAsDefaultInfoBar").try_as()) - { - infoBar.IsOpen(true); - } - } - // Function Description: // - Helper function to get the OS-localized name for the "Touch Keyboard // and Handwriting Panel Service". If we can't open up the service for any @@ -4542,40 +4508,6 @@ namespace winrt::TerminalApp::implementation } } - // Method Description: - // - Persists the user's choice not to show the information bar warning about "Windows Terminal can be set as your default terminal application" - // Then hides this information buffer. - // Arguments: - // - - // Return Value: - // - - void TerminalPage::_SetAsDefaultDismissHandler(const IInspectable& /*sender*/, const IInspectable& /*args*/) - { - _DismissMessage(InfoBarMessage::SetAsDefault); - if (const auto infoBar = FindName(L"SetAsDefaultInfoBar").try_as()) - { - infoBar.IsOpen(false); - } - - TraceLoggingWrite(g_hTerminalAppProvider, "SetAsDefaultTipDismissed", TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage)); - - _FocusCurrentTab(true); - } - - // Method Description: - // - Dismisses the Default Terminal tip and opens the settings. - void TerminalPage::_SetAsDefaultOpenSettingsHandler(const IInspectable& /*sender*/, const IInspectable& /*args*/) - { - if (const auto infoBar = FindName(L"SetAsDefaultInfoBar").try_as()) - { - infoBar.IsOpen(false); - } - - TraceLoggingWrite(g_hTerminalAppProvider, "SetAsDefaultTipInteracted", TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage)); - - OpenSettingsUI(); - } - // Method Description: // - Checks whether information bar message was dismissed earlier (in the application state) // Arguments: diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h index 90caedf4a24..54bd0990d1d 100644 --- a/src/cascadia/TerminalApp/TerminalPage.h +++ b/src/cascadia/TerminalApp/TerminalPage.h @@ -145,7 +145,6 @@ namespace winrt::TerminalApp::implementation winrt::TerminalApp::TaskbarState TaskbarState() const; void ShowKeyboardServiceWarning() const; - void ShowSetAsDefaultInfoBar() const; winrt::hstring KeyboardServiceDisabledText(); winrt::fire_and_forget IdentifyWindow(); @@ -507,8 +506,6 @@ namespace winrt::TerminalApp::implementation winrt::fire_and_forget _ConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const; void _CloseOnExitInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const; void _KeyboardServiceWarningInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const; - void _SetAsDefaultDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args); - void _SetAsDefaultOpenSettingsHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args); static bool _IsMessageDismissed(const winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage& message); static void _DismissMessage(const winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage& message); diff --git a/src/cascadia/TerminalApp/TerminalPage.xaml b/src/cascadia/TerminalApp/TerminalPage.xaml index 600ec505c67..c8aa837bf82 100644 --- a/src/cascadia/TerminalApp/TerminalPage.xaml +++ b/src/cascadia/TerminalApp/TerminalPage.xaml @@ -53,21 +53,6 @@ Click="_CloseOnExitInfoDismissHandler" /> - - - - - -