Skip to content

Commit 58e363d

Browse files
CopilotCopilot
andauthored
Fix Win10 native chat icon fallback (#796)
- Replaces hard-coded Win11-only icon font usage with SymbolThemeFontFamily fallback behavior. - Extends the fix to setup UI glyphs copied into the tray output. - Tightens regression coverage and updates the UI test expectation. Validation: - ./build.ps1 - dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore - dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore - dotnet test ./tests/OpenClaw.Tray.UITests/OpenClaw.Tray.UITests.csproj --no-restore -p:Platform=x64 -p:RuntimeIdentifier=win-x64 --filter FullyQualifiedName~A2UIControlMatrixTests - GitHub Build and Test + CodeQL checks passed Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5d1c65b commit 58e363d

14 files changed

Lines changed: 78 additions & 22 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Microsoft.UI.Xaml;
2+
using Microsoft.UI.Xaml.Media;
3+
4+
namespace OpenClaw.SetupEngine.UI;
5+
6+
internal static class IconFonts
7+
{
8+
public static FontFamily SymbolThemeFontFamily =>
9+
(FontFamily)Application.Current.Resources["SymbolThemeFontFamily"];
10+
}

src/OpenClaw.SetupEngine.UI/Pages/CapabilitiesPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private void BuildToggles()
7474
var icon = new TextBlock
7575
{
7676
Text = glyph,
77-
FontFamily = new Microsoft.UI.Xaml.Media.FontFamily("Segoe Fluent Icons"),
77+
FontFamily = IconFonts.SymbolThemeFontFamily,
7878
FontSize = 20,
7979
VerticalAlignment = VerticalAlignment.Center,
8080
Margin = new Thickness(0, 0, 12, 0),

src/OpenClaw.SetupEngine.UI/Pages/CompletePage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
CornerRadius="48" HorizontalAlignment="Center"
2020
Margin="0,0,0,20" Visibility="Collapsed"
2121
Background="#3CFF4444">
22-
<TextBlock Text="&#xE783;" FontFamily="Segoe Fluent Icons"
22+
<TextBlock Text="&#xE783;" FontFamily="{ThemeResource SymbolThemeFontFamily}"
2323
FontSize="42" Foreground="#FF6B6B"
2424
HorizontalAlignment="Center"
2525
VerticalAlignment="Center" />
@@ -58,7 +58,7 @@
5858
Margin="0,20,0,0">
5959
<StackPanel Spacing="6">
6060
<StackPanel Orientation="Horizontal" Spacing="10">
61-
<TextBlock Text="&#xE7BA;" FontFamily="Segoe Fluent Icons" FontSize="16"
61+
<TextBlock Text="&#xE7BA;" FontFamily="{ThemeResource SymbolThemeFontFamily}" FontSize="16"
6262
VerticalAlignment="Center" Foreground="#FFC107" />
6363
<TextBlock Text="Node Mode Active" FontSize="15" FontWeight="SemiBold" />
6464
</StackPanel>

src/OpenClaw.SetupEngine.UI/Pages/PermissionsPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<Button x:Name="RefreshButton" HorizontalAlignment="Right"
2828
Padding="12,8,12,8" Click="Refresh_Click">
2929
<StackPanel Orientation="Horizontal" Spacing="8">
30-
<TextBlock Text="&#xE72C;" FontFamily="Segoe Fluent Icons" FontSize="14"
30+
<TextBlock Text="&#xE72C;" FontFamily="{ThemeResource SymbolThemeFontFamily}" FontSize="14"
3131
VerticalAlignment="Center" />
3232
<TextBlock Text="Refresh status" FontSize="13" VerticalAlignment="Center" />
3333
</StackPanel>

src/OpenClaw.SetupEngine.UI/Pages/PermissionsPage.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private static FrameworkElement BuildRow(PermDef perm, string status, bool grant
6969
Child = new TextBlock
7070
{
7171
Text = perm.Glyph,
72-
FontFamily = new FontFamily("Segoe Fluent Icons"),
72+
FontFamily = IconFonts.SymbolThemeFontFamily,
7373
FontSize = 20,
7474
Foreground = new SolidColorBrush(isDark ? Microsoft.UI.Colors.White : Microsoft.UI.Colors.White),
7575
HorizontalAlignment = HorizontalAlignment.Center,
@@ -97,7 +97,7 @@ private static FrameworkElement BuildRow(PermDef perm, string status, bool grant
9797
var btnContent = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 6 };
9898
btnContent.Children.Add(new TextBlock
9999
{
100-
Text = "\uE8A7", FontFamily = new FontFamily("Segoe Fluent Icons"),
100+
Text = "\uE8A7", FontFamily = IconFonts.SymbolThemeFontFamily,
101101
FontSize = 14, VerticalAlignment = VerticalAlignment.Center
102102
});
103103
btnContent.Children.Add(new TextBlock { Text = "Open Settings", FontSize = 13, VerticalAlignment = VerticalAlignment.Center });

src/OpenClaw.SetupEngine.UI/Pages/ProgressPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ private static Border CreateIconBadge(string glyph, Color background, Color fore
369369
{
370370
Glyph = glyph,
371371
FontSize = 12,
372-
FontFamily = new FontFamily("Segoe Fluent Icons"),
372+
FontFamily = IconFonts.SymbolThemeFontFamily,
373373
Foreground = new SolidColorBrush(foreground),
374374
HorizontalAlignment = HorizontalAlignment.Center,
375375
VerticalAlignment = VerticalAlignment.Center,

src/OpenClaw.Tray.WinUI/A2UI/Hosting/SurfaceHost.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using OpenClawTray.A2UI.Protocol;
1010
using OpenClawTray.A2UI.Rendering;
1111
using OpenClawTray.A2UI.Theming;
12+
using OpenClawTray.Helpers;
1213

1314
namespace OpenClawTray.A2UI.Hosting;
1415

@@ -260,7 +261,7 @@ private static FrameworkElement BuildErrorPlaceholder(string componentName, stri
260261
stack.Children.Add(new FontIcon
261262
{
262263
Glyph = "",
263-
FontFamily = new FontFamily("Segoe Fluent Icons"),
264+
FontFamily = FluentIconCatalog.SymbolThemeFontFamily,
264265
});
265266
stack.Children.Add(new TextBlock
266267
{

src/OpenClaw.Tray.WinUI/A2UI/Rendering/Renderers/DisplayRenderers.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Microsoft.UI.Xaml.Controls;
55
using Microsoft.UI.Xaml.Media;
66
using OpenClawTray.A2UI.Protocol;
7+
using OpenClawTray.Helpers;
78

89
namespace OpenClawTray.A2UI.Rendering.Renderers;
910

@@ -232,7 +233,7 @@ public FrameworkElement Render(A2UIComponentDef c, RenderContext ctx)
232233
{
233234
var fontIcon = new FontIcon
234235
{
235-
FontFamily = new FontFamily("Segoe Fluent Icons"),
236+
FontFamily = FluentIconCatalog.SymbolThemeFontFamily,
236237
FontSize = 16,
237238
};
238239
var nameVal = ctx.GetValue(c, "name");

src/OpenClaw.Tray.WinUI/A2UI/Rendering/Renderers/UnknownRenderer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Microsoft.UI.Xaml.Controls;
44
using Microsoft.UI.Xaml.Media;
55
using OpenClawTray.A2UI.Protocol;
6+
using OpenClawTray.Helpers;
67

78
namespace OpenClawTray.A2UI.Rendering.Renderers;
89

@@ -29,7 +30,7 @@ public FrameworkElement Render(A2UIComponentDef component, RenderContext ctx)
2930
stack.Children.Add(new FontIcon
3031
{
3132
Glyph = "", // outlined warning
32-
FontFamily = new FontFamily("Segoe Fluent Icons"),
33+
FontFamily = FluentIconCatalog.SymbolThemeFontFamily,
3334
});
3435
var template = OpenClawTray.Helpers.LocalizationHelper.GetString("A2UI_UnsupportedComponent");
3536
stack.Children.Add(new TextBlock

src/OpenClaw.Tray.WinUI/Chat/OpenClawChatTimeline.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ Element HoverIcon(string entryId, string actionKey, string glyph, string ackGlyp
785785
TextBlock(shownGlyph)
786786
.Set(t =>
787787
{
788-
t.FontFamily = new FontFamily("Segoe Fluent Icons, Segoe MDL2 Assets");
788+
t.FontFamily = FluentIconCatalog.SymbolThemeFontFamily;
789789
t.FontSize = 14;
790790
t.FontWeight = Microsoft.UI.Text.FontWeights.Light;
791791
t.Foreground = shownColor;
@@ -1062,7 +1062,7 @@ Element RenderUserEntry(ChatTimelineItem entry, bool startsBurst, bool endsBurst
10621062
TextBlock(fileGlyph)
10631063
.Set(t =>
10641064
{
1065-
t.FontFamily = new FontFamily("Segoe Fluent Icons");
1065+
t.FontFamily = FluentIconCatalog.SymbolThemeFontFamily;
10661066
t.FontSize = 16;
10671067
t.Foreground = userBubbleFg;
10681068
t.VerticalAlignment = VerticalAlignment.Center;

0 commit comments

Comments
 (0)