Skip to content

Commit bd33c7f

Browse files
nukoseerDHowett
authored andcommitted
Add tab color indicator for tab switch menu (CTRL+Tab) (#17820)
Added tab color indicator for the tab switch menu. Tab color indicators have the same color as the background color of the tabs. If a tab has the default background color, the indicator is not shown in the tab switch menu. Closes #17465 (cherry picked from commit 544452d) Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgS0CZA Service-Version: 1.22
1 parent 893f32c commit bd33c7f

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

src/cascadia/TerminalApp/CommandPalette.xaml

+7
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,13 @@
205205
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsInputBroadcastActive, Mode=OneWay}" />
206206

207207
</StackPanel>
208+
209+
<Ellipse Grid.Column="4"
210+
Width="8"
211+
Height="8"
212+
HorizontalAlignment="Center"
213+
VerticalAlignment="Center"
214+
Fill="{x:Bind mtu:Converters.ColorToBrush(Item.(local:TabPaletteItem.TabStatus).TabColorIndicator), Mode=OneWay}" />
208215
</Grid>
209216
</DataTemplate>
210217

src/cascadia/TerminalApp/TerminalTab.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,7 @@ namespace winrt::TerminalApp::implementation
976976
// active control in this tab. We'll just recalculate the
977977
// current color anyways.
978978
tab->_RecalculateAndApplyTabColor();
979+
tab->_tabStatus.TabColorIndicator(tab->GetTabColor().value_or(Windows::UI::Colors::Transparent()));
979980
}
980981
});
981982

@@ -1617,6 +1618,7 @@ namespace winrt::TerminalApp::implementation
16171618

16181619
_runtimeTabColor.emplace(color);
16191620
_RecalculateAndApplyTabColor();
1621+
_tabStatus.TabColorIndicator(color);
16201622
}
16211623

16221624
// Method Description:
@@ -1633,6 +1635,7 @@ namespace winrt::TerminalApp::implementation
16331635

16341636
_runtimeTabColor.reset();
16351637
_RecalculateAndApplyTabColor();
1638+
_tabStatus.TabColorIndicator(GetTabColor().value_or(Windows::UI::Colors::Transparent()));
16361639
}
16371640

16381641
winrt::Windows::UI::Xaml::Media::Brush TerminalTab::_BackgroundBrush()

src/cascadia/TerminalApp/TerminalTabStatus.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace winrt::TerminalApp::implementation
2020
WINRT_OBSERVABLE_PROPERTY(bool, IsReadOnlyActive, PropertyChanged.raise);
2121
WINRT_OBSERVABLE_PROPERTY(uint32_t, ProgressValue, PropertyChanged.raise);
2222
WINRT_OBSERVABLE_PROPERTY(bool, IsInputBroadcastActive, PropertyChanged.raise);
23+
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Color, TabColorIndicator, PropertyChanged.raise);
2324
};
2425
}
2526

src/cascadia/TerminalApp/TerminalTabStatus.idl

+1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ namespace TerminalApp
1515
UInt32 ProgressValue { get; set; };
1616
Boolean IsReadOnlyActive { get; set; };
1717
Boolean IsInputBroadcastActive { get; set; };
18+
Windows.UI.Color TabColorIndicator { get; set; };
1819
}
1920
}

src/cascadia/TerminalApp/pch.h

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <winrt/Windows.UI.Xaml.Automation.Peers.h>
4141
#include <winrt/Windows.UI.Xaml.Controls.h>
4242
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
43+
#include <winrt/Windows.UI.Xaml.Shapes.h>
4344
#include <winrt/Windows.UI.Xaml.Data.h>
4445
#include <winrt/Windows.UI.Xaml.Documents.h>
4546
#include <winrt/Windows.UI.Xaml.Input.h>

0 commit comments

Comments
 (0)