Skip to content

Commit a50eba1

Browse files
committed
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 febfbeb) Service-Card-Id: 92139784 Service-Version: 1.20
1 parent 98f675e commit a50eba1

File tree

6 files changed

+8
-97
lines changed

6 files changed

+8
-97
lines changed

src/cascadia/TerminalApp/Resources/en-US/Resources.resw

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -771,19 +771,12 @@
771771
<data name="CloseOnExitInfoBar.Message" xml:space="preserve">
772772
<value>Termination behavior can be configured in advanced profile settings.</value>
773773
</data>
774-
<data name="SetAsDefaultInfoBar.Message" xml:space="preserve">
775-
<value>Windows Terminal can be set as the default terminal application in your settings.</value>
776-
</data>
777774
<data name="InfoBarDismissButton.Content" xml:space="preserve">
778775
<value>Don't show again</value>
779776
</data>
780777
<data name="ElevationShield.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
781778
<value>This Terminal window is running as Admin</value>
782779
</data>
783-
<data name="SetAsDefaultTip_OpenSettingsLink.Content" xml:space="preserve">
784-
<value>Open Settings</value>
785-
<comment>This is a call-to-action hyperlink; it will open the settings.</comment>
786-
</data>
787780
<data name="CommandPalette_MatchesAvailable" xml:space="preserve">
788781
<value>Suggestions found: {0}</value>
789782
<comment>{0} will be replaced with a number.</comment>

src/cascadia/TerminalApp/TerminalPage.cpp

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ namespace winrt::TerminalApp::implementation
283283
_defaultPointerCursor = CoreWindow::GetForCurrentThread().PointerCursor();
284284
}
285285
CATCH_LOG();
286-
287-
ShowSetAsDefaultInfoBar();
288286
}
289287

290288
Windows::UI::Xaml::Automation::Peers::AutomationPeer TerminalPage::OnCreateAutomationPeer()
@@ -3868,9 +3866,6 @@ namespace winrt::TerminalApp::implementation
38683866
// Request a summon of this window to the foreground
38693867
_SummonWindowRequestedHandlers(*this, nullptr);
38703868

3871-
const IInspectable unused{ nullptr };
3872-
_SetAsDefaultDismissHandler(unused, unused);
3873-
38743869
// TEMPORARY SOLUTION
38753870
// If the connection has requested for the window to be maximized,
38763871
// manually maximize it here. Ideally, we should be _initializing_
@@ -4052,35 +4047,6 @@ namespace winrt::TerminalApp::implementation
40524047
}
40534048
}
40544049

4055-
// Method Description:
4056-
// - Displays a info popup guiding the user into setting their default terminal.
4057-
void TerminalPage::ShowSetAsDefaultInfoBar() const
4058-
{
4059-
if (::winrt::Windows::UI::Xaml::Application::Current().try_as<::winrt::TerminalApp::App>() == nullptr)
4060-
{
4061-
// Just ignore this in the tests (where the Application::Current()
4062-
// is not a TerminalApp::App)
4063-
return;
4064-
}
4065-
if (!CascadiaSettings::IsDefaultTerminalAvailable() || _IsMessageDismissed(InfoBarMessage::SetAsDefault))
4066-
{
4067-
return;
4068-
}
4069-
4070-
// If the user has already configured any terminal for hand-off we
4071-
// shouldn't inform them again about the possibility to do so.
4072-
if (CascadiaSettings::IsDefaultTerminalSet())
4073-
{
4074-
_DismissMessage(InfoBarMessage::SetAsDefault);
4075-
return;
4076-
}
4077-
4078-
if (const auto infoBar = FindName(L"SetAsDefaultInfoBar").try_as<MUX::Controls::InfoBar>())
4079-
{
4080-
infoBar.IsOpen(true);
4081-
}
4082-
}
4083-
40844050
// Function Description:
40854051
// - Helper function to get the OS-localized name for the "Touch Keyboard
40864052
// and Handwriting Panel Service". If we can't open up the service for any
@@ -4542,40 +4508,6 @@ namespace winrt::TerminalApp::implementation
45424508
}
45434509
}
45444510

4545-
// Method Description:
4546-
// - Persists the user's choice not to show the information bar warning about "Windows Terminal can be set as your default terminal application"
4547-
// Then hides this information buffer.
4548-
// Arguments:
4549-
// - <none>
4550-
// Return Value:
4551-
// - <none>
4552-
void TerminalPage::_SetAsDefaultDismissHandler(const IInspectable& /*sender*/, const IInspectable& /*args*/)
4553-
{
4554-
_DismissMessage(InfoBarMessage::SetAsDefault);
4555-
if (const auto infoBar = FindName(L"SetAsDefaultInfoBar").try_as<MUX::Controls::InfoBar>())
4556-
{
4557-
infoBar.IsOpen(false);
4558-
}
4559-
4560-
TraceLoggingWrite(g_hTerminalAppProvider, "SetAsDefaultTipDismissed", TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
4561-
4562-
_FocusCurrentTab(true);
4563-
}
4564-
4565-
// Method Description:
4566-
// - Dismisses the Default Terminal tip and opens the settings.
4567-
void TerminalPage::_SetAsDefaultOpenSettingsHandler(const IInspectable& /*sender*/, const IInspectable& /*args*/)
4568-
{
4569-
if (const auto infoBar = FindName(L"SetAsDefaultInfoBar").try_as<MUX::Controls::InfoBar>())
4570-
{
4571-
infoBar.IsOpen(false);
4572-
}
4573-
4574-
TraceLoggingWrite(g_hTerminalAppProvider, "SetAsDefaultTipInteracted", TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
4575-
4576-
OpenSettingsUI();
4577-
}
4578-
45794511
// Method Description:
45804512
// - Checks whether information bar message was dismissed earlier (in the application state)
45814513
// Arguments:

src/cascadia/TerminalApp/TerminalPage.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ namespace winrt::TerminalApp::implementation
145145
winrt::TerminalApp::TaskbarState TaskbarState() const;
146146

147147
void ShowKeyboardServiceWarning() const;
148-
void ShowSetAsDefaultInfoBar() const;
149148
winrt::hstring KeyboardServiceDisabledText();
150149

151150
winrt::fire_and_forget IdentifyWindow();
@@ -507,8 +506,6 @@ namespace winrt::TerminalApp::implementation
507506
winrt::fire_and_forget _ConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
508507
void _CloseOnExitInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
509508
void _KeyboardServiceWarningInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
510-
void _SetAsDefaultDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
511-
void _SetAsDefaultOpenSettingsHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
512509
static bool _IsMessageDismissed(const winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage& message);
513510
static void _DismissMessage(const winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage& message);
514511

src/cascadia/TerminalApp/TerminalPage.xaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,6 @@
5353
Click="_CloseOnExitInfoDismissHandler" />
5454
</mux:InfoBar.ActionButton>
5555
</mux:InfoBar>
56-
57-
<mux:InfoBar x:Name="SetAsDefaultInfoBar"
58-
x:Uid="SetAsDefaultInfoBar"
59-
x:Load="False"
60-
CloseButtonClick="_SetAsDefaultDismissHandler"
61-
CornerRadius="0"
62-
IsClosable="True"
63-
IsIconVisible="True"
64-
IsOpen="False"
65-
Severity="Informational">
66-
<mux:InfoBar.ActionButton>
67-
<HyperlinkButton x:Uid="SetAsDefaultTip_OpenSettingsLink"
68-
Click="_SetAsDefaultOpenSettingsHandler" />
69-
</mux:InfoBar.ActionButton>
70-
</mux:InfoBar>
7156
</StackPanel>
7257

7358
<Grid x:Name="TabContent"

src/cascadia/TerminalSettingsModel/ApplicationState.idl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ namespace Microsoft.Terminal.Settings.Model
77
{
88
enum InfoBarMessage
99
{
10-
CloseOnExitInfo = 0,
10+
// We need a sentinel value to map deleted keys to, as we can't actually delete them (GH#16874)
11+
IgnoredDeprecatedEntry = 0,
12+
CloseOnExitInfo,
1113
KeyboardServiceWarning,
12-
SetAsDefault,
1314
};
1415

1516
runtimeclass WindowLayout

src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,13 @@ JSON_FLAG_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::IntenseStyle)
559559

560560
JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage)
561561
{
562-
JSON_MAPPINGS(3) = {
562+
JSON_MAPPINGS(4) = {
563+
pair_type{ "deprecated", ValueType::IgnoredDeprecatedEntry },
563564
pair_type{ "closeOnExitInfo", ValueType::CloseOnExitInfo },
564565
pair_type{ "keyboardServiceWarning", ValueType::KeyboardServiceWarning },
565-
pair_type{ "setAsDefault", ValueType::SetAsDefault },
566+
567+
// Keep deprecated keys last, so when they get serialized again they aren't written out
568+
pair_type{ "setAsDefault", ValueType::IgnoredDeprecatedEntry },
566569
};
567570
};
568571

0 commit comments

Comments
 (0)