filter out unneeded categories

This commit is contained in:
MyDrift 2024-08-15 22:30:57 +02:00
parent 3f48c8aa70
commit 4c6990b515
2 changed files with 13 additions and 2 deletions

View File

@ -87,7 +87,6 @@ function Invoke-WPFUIElements {
# Only apply the logic for distributing entries across columns if the targetGridName is "appspanel" # Only apply the logic for distributing entries across columns if the targetGridName is "appspanel"
if ($targetGridName -eq "appspanel") { if ($targetGridName -eq "appspanel") {
$panelcount = 0 $panelcount = 0
$paneltotal = $columncount # Use columncount for even distribution
$entrycount = $configHashtable.Keys.Count + $organizedData["0"].Keys.Count $entrycount = $configHashtable.Keys.Count + $organizedData["0"].Keys.Count
$maxcount = [Math]::Round($entrycount / $columncount + 0.5) $maxcount = [Math]::Round($entrycount / $columncount + 0.5)
} }
@ -139,7 +138,6 @@ function Invoke-WPFUIElements {
$stackPanel.Children.Add($label) | Out-Null $stackPanel.Children.Add($label) | Out-Null
$sync[$category] = $label $sync[$category] = $label
write-host $sync[$category]
# Sort entries by Order and then by Name, but only display Name # Sort entries by Order and then by Name, but only display Name
$entries = $organizedData[$panelKey][$category] | Sort-Object Order, Name $entries = $organizedData[$panelKey][$category] | Sort-Object Order, Name

View File

@ -410,6 +410,19 @@ $sync["SearchBar"].Add_TextChanged({
} }
} }
} }
$activeCategories = $activeApplications | Select-Object -ExpandProperty category -Unique
foreach ($category in $activeCategories) {
$sync[$category].Visibility = "Visible"
}
if ($activeCategories) {
$inactiveCategories = Compare-Object -ReferenceObject $allCategories -DifferenceObject $activeCategories -PassThru
} else {
$inactiveCategories = $allCategories
}
foreach ($category in $inactiveCategories) {
$sync[$category].Visibility = "Collapsed"}
}) })
# Initialize the hashtable # Initialize the hashtable