mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-08-23 08:02:07 +00:00
Fix win10 icons by falling back to Segoe MDL2 Assets (#696)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user