From 89a5d508d8fe47e27fd3dcc8e4a38dc2bda4e16b Mon Sep 17 00:00:00 2001 From: Jeffrey <9938813+Raphire@users.noreply.github.com> Date: Wed, 8 Jul 2026 23:16:01 +0200 Subject: [PATCH] Fix win10 icons by falling back to Segoe MDL2 Assets (#696) --- Schemas/AboutWindow.xaml | 2 +- Schemas/AppSelectionWindow.xaml | 2 +- Schemas/ApplyChangesWindow.xaml | 10 ++-- Schemas/MainWindow.xaml | 58 ++++++++++++------------ Schemas/MessageBox.xaml | 2 +- Schemas/RestoreBackupWindow.xaml | 6 +-- Schemas/SharedStyles.xaml | 6 +-- Scripts/GUI/MainWindow-TweaksBuilder.ps1 | 11 +++-- Scripts/GUI/SetWindowThemeResources.ps1 | 9 +++- 9 files changed, 59 insertions(+), 47 deletions(-) diff --git a/Schemas/AboutWindow.xaml b/Schemas/AboutWindow.xaml index 4ef56c5..c804e70 100644 --- a/Schemas/AboutWindow.xaml +++ b/Schemas/AboutWindow.xaml @@ -105,7 +105,7 @@ HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="SemiBold" - FontFamily="Segoe Fluent Icons" + FontFamily="{DynamicResource AppIconFontFamily}" Text="" Foreground="{DynamicResource TitleBarCloseHoverColor}" Margin="0,0,8,0"/> diff --git a/Schemas/AppSelectionWindow.xaml b/Schemas/AppSelectionWindow.xaml index c31959a..0817957 100644 --- a/Schemas/AppSelectionWindow.xaml +++ b/Schemas/AppSelectionWindow.xaml @@ -16,7 +16,7 @@ - + diff --git a/Schemas/ApplyChangesWindow.xaml b/Schemas/ApplyChangesWindow.xaml index 8a98941..dae9a79 100644 --- a/Schemas/ApplyChangesWindow.xaml +++ b/Schemas/ApplyChangesWindow.xaml @@ -44,7 +44,7 @@ - + @@ -54,7 +54,7 @@ - + diff --git a/Schemas/MainWindow.xaml b/Schemas/MainWindow.xaml index 4a9ce76..0132b8c 100644 --- a/Schemas/MainWindow.xaml +++ b/Schemas/MainWindow.xaml @@ -65,7 +65,7 @@ - + - + @@ -596,7 +596,7 @@ @@ -627,7 +627,7 @@ - + @@ -658,19 +658,19 @@ - + - + - + @@ -684,7 +684,7 @@ - + @@ -789,9 +789,9 @@ - + - + @@ -800,7 +800,7 @@ @@ -832,7 +832,7 @@ - + @@ -986,7 +986,7 @@ @@ -1006,7 +1006,7 @@ @@ -1015,7 +1015,7 @@ diff --git a/Schemas/MessageBox.xaml b/Schemas/MessageBox.xaml index 1324603..1e10a1f 100644 --- a/Schemas/MessageBox.xaml +++ b/Schemas/MessageBox.xaml @@ -49,7 +49,7 @@ - + @@ -135,7 +135,7 @@ @@ -165,7 +165,7 @@ diff --git a/Schemas/SharedStyles.xaml b/Schemas/SharedStyles.xaml index 4f905c2..9aadf37 100644 --- a/Schemas/SharedStyles.xaml +++ b/Schemas/SharedStyles.xaml @@ -272,7 +272,7 @@ - + - + diff --git a/Scripts/GUI/MainWindow-TweaksBuilder.ps1 b/Scripts/GUI/MainWindow-TweaksBuilder.ps1 index 6125aec..ec6bb8f 100644 --- a/Scripts/GUI/MainWindow-TweaksBuilder.ps1 +++ b/Scripts/GUI/MainWindow-TweaksBuilder.ps1 @@ -132,6 +132,9 @@ function Build-DynamicTweaks { # Convert HTML entity to character (e.g.,  -> actual character) if ($categoryIcon -match '&#x([0-9A-Fa-f]+);') { $hexValue = [Convert]::ToInt32($matches[1], 16) + if ($WinVersion -lt 22000 -and $hexValue -eq 0xE794) { + $hexValue = 0xE734 + } $icon.Text = [char]$hexValue } $icon.Style = $Window.Resources['CategoryHeaderIcon'] @@ -201,9 +204,8 @@ function Build-DynamicTweaks { foreach ($categoryObj in $orderedCategories) { $categoryName = $categoryObj.Name - # Create/get card for this category - $panel = GetOrCreateCategoryCard -categoryObj $categoryObj - if (-not $panel) { continue } + # Card is created lazily on the first rendered item + $panel = $null # Collect groups and features for this category, then sort by priority $categoryItems = @() @@ -287,6 +289,7 @@ function Build-DynamicTweaks { if ($soleFeature.FeatureId -match '^Disable') { $opt = 'Disable' } elseif ($soleFeature.FeatureId -match '^Enable') { $opt = 'Enable' } $items = @('No Change', $opt) $comboName = ("Feature_{0}_Combo" -f $soleFeature.FeatureId) -replace '[^a-zA-Z0-9_]', '' + if (-not $panel) { $panel = GetOrCreateCategoryCard -categoryObj $categoryObj } $combo = CreateLabeledCombo -parent $panel -labelText $soleFeature.Label -comboName $comboName -items $items # attach tooltip from Features.json if present if ($soleFeature.ToolTip -or $soleFeature.DisableWhenApplied -eq $true) { @@ -311,6 +314,7 @@ function Build-DynamicTweaks { $items = @('No Change') + ($filteredValues | ForEach-Object { $_.Label }) $comboName = 'Group_{0}Combo' -f $group.GroupId + if (-not $panel) { $panel = GetOrCreateCategoryCard -categoryObj $categoryObj } $combo = CreateLabeledCombo -parent $panel -labelText $group.Label -comboName $comboName -items $items # attach tooltip from UiGroups if present if ($group.ToolTip) { @@ -331,6 +335,7 @@ function Build-DynamicTweaks { if ($feature.FeatureId -match '^Disable') { $opt = 'Disable' } elseif ($feature.FeatureId -match '^Enable') { $opt = 'Enable' } $items = @('No Change', $opt) $comboName = ("Feature_{0}_Combo" -f $feature.FeatureId) -replace '[^a-zA-Z0-9_]', '' + if (-not $panel) { $panel = GetOrCreateCategoryCard -categoryObj $categoryObj } $combo = CreateLabeledCombo -parent $panel -labelText $feature.Label -comboName $comboName -items $items # attach tooltip from Features.json if present, and include the disabled-state reason if ($feature.ToolTip -or $feature.DisableWhenApplied -eq $true) { diff --git a/Scripts/GUI/SetWindowThemeResources.ps1 b/Scripts/GUI/SetWindowThemeResources.ps1 index e3f3462..dd58412 100644 --- a/Scripts/GUI/SetWindowThemeResources.ps1 +++ b/Scripts/GUI/SetWindowThemeResources.ps1 @@ -7,7 +7,8 @@ populates the window's Resources with SolidColorBrush entries keyed by category and resource name (e.g. "AppAccentColor"). Additionally loads and merges shared XAML styles from the script's SharedStylesSchema path if - available. + available. Also resolves the icon font: Segoe Fluent Icons on Windows 11 + and Segoe MDL2 Assets on Windows 10. .PARAMETER window The WPF Window whose resource dictionary will be populated. @@ -122,6 +123,12 @@ function SetWindowThemeResources { } } + # Segoe Fluent Icons ships only on Windows 11 (build >= 22000). + # On Windows 10, fall back to Segoe MDL2 Assets. + $winBuild = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' CurrentBuild + $iconFontName = if ($winBuild -ge 22000) { 'Segoe Fluent Icons' } else { 'Segoe MDL2 Assets' } + $window.Resources['AppIconFontFamily'] = [System.Windows.Media.FontFamily]::new($iconFontName) + # Load and merge shared styles if ($script:SharedStylesSchema -and (Test-Path $script:SharedStylesSchema)) { $sharedXaml = Get-Content -Path $script:SharedStylesSchema -Raw