diff --git a/src/cascadia/TerminalApp/CommandPalette.xaml b/src/cascadia/TerminalApp/CommandPalette.xaml index 4a3864adb75b..378cd11abdca 100644 --- a/src/cascadia/TerminalApp/CommandPalette.xaml +++ b/src/cascadia/TerminalApp/CommandPalette.xaml @@ -205,6 +205,13 @@ Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsInputBroadcastActive, Mode=OneWay}" /> </StackPanel> + + <Ellipse Grid.Column="4" + Width="8" + Height="8" + HorizontalAlignment="Center" + VerticalAlignment="Center" + Fill="{x:Bind mtu:Converters.ColorToBrush(Item.TabColorIndicator), Mode=OneWay}" /> </Grid> </DataTemplate> diff --git a/src/cascadia/TerminalApp/PaletteItem.h b/src/cascadia/TerminalApp/PaletteItem.h index f1cea0190566..ba2434766d82 100644 --- a/src/cascadia/TerminalApp/PaletteItem.h +++ b/src/cascadia/TerminalApp/PaletteItem.h @@ -15,6 +15,7 @@ namespace winrt::TerminalApp::implementation WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Name, PropertyChanged.raise); WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Icon, PropertyChanged.raise); + WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Color, TabColorIndicator, PropertyChanged.raise); WINRT_OBSERVABLE_PROPERTY(winrt::hstring, KeyChordText, PropertyChanged.raise); }; } diff --git a/src/cascadia/TerminalApp/PaletteItem.idl b/src/cascadia/TerminalApp/PaletteItem.idl index c4273de5d1cb..852c9805de93 100644 --- a/src/cascadia/TerminalApp/PaletteItem.idl +++ b/src/cascadia/TerminalApp/PaletteItem.idl @@ -8,6 +8,7 @@ namespace TerminalApp String Name; String KeyChordText; String Icon; + Windows.UI.Color TabColorIndicator; Windows.UI.Xaml.Controls.IconElement ResolvedIcon { get; }; } } diff --git a/src/cascadia/TerminalApp/TabBase.cpp b/src/cascadia/TerminalApp/TabBase.cpp index 2d5e8da44330..15bae8ea6def 100644 --- a/src/cascadia/TerminalApp/TabBase.cpp +++ b/src/cascadia/TerminalApp/TabBase.cpp @@ -340,6 +340,22 @@ namespace winrt::TerminalApp::implementation { _ClearTabBackgroundColor(); } + + _UpdateTabColorIndicator(); + } + + void TabBase::_UpdateTabColorIndicator() + { + const auto currentColor = GetTabColor(); + + if (currentColor.has_value()) + { + TabColorIndicator(currentColor.value()); + } + else + { + TabColorIndicator(Windows::UI::Colors::Transparent()); + } } // Method Description: diff --git a/src/cascadia/TerminalApp/TabBase.h b/src/cascadia/TerminalApp/TabBase.h index 9a538550b8da..c4b2170bde70 100644 --- a/src/cascadia/TerminalApp/TabBase.h +++ b/src/cascadia/TerminalApp/TabBase.h @@ -45,6 +45,7 @@ namespace winrt::TerminalApp::implementation WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Title, PropertyChanged.raise); WINRT_OBSERVABLE_PROPERTY(winrt::hstring, Icon, PropertyChanged.raise); + WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Color, TabColorIndicator, PropertyChanged.raise); WINRT_OBSERVABLE_PROPERTY(bool, ReadOnly, PropertyChanged.raise, false); WINRT_PROPERTY(winrt::Microsoft::UI::Xaml::Controls::TabViewItem, TabViewItem, nullptr); @@ -78,6 +79,7 @@ namespace winrt::TerminalApp::implementation void _RecalculateAndApplyTabColor(); void _ApplyTabColorOnUIThread(const winrt::Windows::UI::Color& color); + void _UpdateTabColorIndicator(); void _ClearTabBackgroundColor(); void _RefreshVisualState(); virtual winrt::Windows::UI::Xaml::Media::Brush _BackgroundBrush() = 0; diff --git a/src/cascadia/TerminalApp/TabBase.idl b/src/cascadia/TerminalApp/TabBase.idl index 20ee8ffa9d00..dac77d51f8b0 100644 --- a/src/cascadia/TerminalApp/TabBase.idl +++ b/src/cascadia/TerminalApp/TabBase.idl @@ -8,6 +8,7 @@ namespace TerminalApp { String Title { get; }; String Icon { get; }; + Windows.UI.Color TabColorIndicator { get; }; Boolean ReadOnly { get; }; Microsoft.Terminal.Settings.Model.TabCloseButtonVisibility CloseButtonVisibility { get; set; }; diff --git a/src/cascadia/TerminalApp/TabPaletteItem.cpp b/src/cascadia/TerminalApp/TabPaletteItem.cpp index e3c550206d67..ec319e8e82cb 100644 --- a/src/cascadia/TerminalApp/TabPaletteItem.cpp +++ b/src/cascadia/TerminalApp/TabPaletteItem.cpp @@ -24,6 +24,7 @@ namespace winrt::TerminalApp::implementation { Name(tab.Title()); Icon(tab.Icon()); + TabColorIndicator(tab.TabColorIndicator()); _tabChangedRevoker = tab.PropertyChanged(winrt::auto_revoke, [weakThis{ get_weak() }](auto& sender, auto& e) { auto item{ weakThis.get() }; @@ -40,6 +41,10 @@ namespace winrt::TerminalApp::implementation { item->Icon(senderTab.Icon()); } + else if (changedProperty == L"TabColorIndicator") + { + item->TabColorIndicator(senderTab.TabColorIndicator()); + } } }); diff --git a/src/cascadia/TerminalApp/pch.h b/src/cascadia/TerminalApp/pch.h index d5e840a7b724..ec2655d349f9 100644 --- a/src/cascadia/TerminalApp/pch.h +++ b/src/cascadia/TerminalApp/pch.h @@ -40,6 +40,7 @@ #include <winrt/Windows.UI.Xaml.Automation.Peers.h> #include <winrt/Windows.UI.Xaml.Controls.h> #include <winrt/Windows.UI.Xaml.Controls.Primitives.h> +#include <winrt/Windows.UI.Xaml.Shapes.h> #include <winrt/Windows.UI.Xaml.Data.h> #include <winrt/Windows.UI.Xaml.Documents.h> #include <winrt/Windows.UI.Xaml.Input.h>