Skip to content

Commit

Permalink
Add tab color indicator for tab switch menu (CTRL+Tab) (#17820)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nukoseer authored Sep 6, 2024
1 parent 00f46e4 commit 544452d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cascadia/TerminalApp/CommandPalette.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.(local:TabPaletteItem.TabStatus).TabColorIndicator), Mode=OneWay}" />
</Grid>
</DataTemplate>

Expand Down
3 changes: 3 additions & 0 deletions src/cascadia/TerminalApp/TerminalTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ namespace winrt::TerminalApp::implementation
// active control in this tab. We'll just recalculate the
// current color anyways.
tab->_RecalculateAndApplyTabColor();
tab->_tabStatus.TabColorIndicator(tab->GetTabColor().value_or(Windows::UI::Colors::Transparent()));
}
});

Expand Down Expand Up @@ -1617,6 +1618,7 @@ namespace winrt::TerminalApp::implementation

_runtimeTabColor.emplace(color);
_RecalculateAndApplyTabColor();
_tabStatus.TabColorIndicator(color);
}

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

_runtimeTabColor.reset();
_RecalculateAndApplyTabColor();
_tabStatus.TabColorIndicator(GetTabColor().value_or(Windows::UI::Colors::Transparent()));
}

winrt::Windows::UI::Xaml::Media::Brush TerminalTab::_BackgroundBrush()
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/TerminalTabStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace winrt::TerminalApp::implementation
WINRT_OBSERVABLE_PROPERTY(bool, IsReadOnlyActive, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(uint32_t, ProgressValue, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(bool, IsInputBroadcastActive, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Color, TabColorIndicator, PropertyChanged.raise);
};
}

Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/TerminalTabStatus.idl
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ namespace TerminalApp
UInt32 ProgressValue { get; set; };
Boolean IsReadOnlyActive { get; set; };
Boolean IsInputBroadcastActive { get; set; };
Windows.UI.Color TabColorIndicator { get; set; };
}
}
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 544452d

Please sign in to comment.