Show preset JSON key in app, tweak, and feature tooltips (#4995)

* Add Get-WinUtilEntryToolTip helper for preset-key tooltips

* Show preset JSON key in app and tweak tooltips

* Match apps search against preset key for consistency with tweaks

* Limit preset-key tooltips to preset-representable controls

Comboboxes and package-manager radio buttons cannot appear in a preset
file. Update-WinUtilSelections routes a flat list of keys by the
WPFInstall/WPFTweaks/WPFToggle/WPFFeature/WPFAppx prefixes, so a preset
can carry neither a combobox selected value nor a radio group choice;
WingetRadioButton and ChocoRadioButton do not even carry a WPF prefix.
Advertising those control names as preset keys invited users to add keys
that fall through the switch and abort the whole import.

Revert the combobox label and radio button tooltips to the plain
description, and add tests that fail if the key is reattached to a
control the preset importer cannot accept.

* fix: address preset key review feedback

* docs: clarify preset key search scope

---------

Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
Malin Fossum
2026-08-19 16:26:11 -05:00
committed by GitHub
co-authored by Chris Titus
parent a7074963a6
commit b8b81edcdb
7 changed files with 166 additions and 7 deletions
@@ -5,9 +5,9 @@ function Find-AppsByNameOrDescription {
.DESCRIPTION
Search text and categories are independent filters that both have to pass. An entry is
shown when its name or description matches the search text, and when its category is in
the selected set. An empty search matches everything, and an empty category set matches
every category.
shown when its name, description, or application preset key matches the search text, and
when its category is in the selected set. An empty search matches everything, and an empty
category set matches every category.
While either filter is active the matching categories are expanded, since a collapsed
category would otherwise hide the very results that were asked for. With no filter at
@@ -115,7 +115,8 @@ function Find-AppsByNameOrDescription {
$categoryMatch = -not $hasCategories -or $activeCategories -contains $appEntry.Category
$textMatch = -not $hasSearch -or
$appEntry.Content -like "*$escapedSearchString*" -or
$appEntry.Description -like "*$escapedSearchString*"
$appEntry.Description -like "*$escapedSearchString*" -or
$appTag -like "*$escapedSearchString*"
if ($categoryMatch -and $textMatch) {
$appControl.Visibility = [Windows.Visibility]::Visible
@@ -0,0 +1,25 @@
function Get-WinUtilEntryToolTip {
<#
.SYNOPSIS
Builds the tooltip string for an app/tweak/feature entry: its description plus its preset JSON key
.PARAMETER Description
The entry's description from the config JSON. May be null or empty.
.PARAMETER Key
The entry's JSON key as used in preset files (e.g. WPFInstallbrave, WPFTweaksTele).
#>
param(
[Parameter(Mandatory = $false)]
[string]$Description,
[Parameter(Mandatory = $true)]
[string]$Key
)
if ([string]::IsNullOrWhiteSpace($Description)) {
return "Preset key: $Key"
}
return "$Description`n`nPreset key: $Key"
}
@@ -19,7 +19,7 @@ function Initialize-InstallAppEntry {
$border = New-Object Windows.Controls.Border
$border.Style = $sync.Form.Resources.AppEntryBorderStyle
$border.Tag = $appKey
$border.ToolTip = $app.description
$border.ToolTip = Get-WinUtilEntryToolTip -Description $app.description -Key $appKey
$border.Add_MouseLeftButtonUp({
# Resolve through $sync because the border's child is a layout Grid for FOSS entries
$childCheckbox = $sync.$($this.Tag)
+2 -2
View File
@@ -224,7 +224,7 @@ function Invoke-WPFUIElements {
$toggleButton = New-Object Windows.Controls.Primitives.ToggleButton
$toggleButton.Name = $entryInfo.Name
$toggleButton.Content = $entryInfo.Content[1]
$toggleButton.ToolTip = $entryInfo.Description
$toggleButton.ToolTip = Get-WinUtilEntryToolTip -Description $entryInfo.Description -Key $entryInfo.Name
$toggleButton.HorizontalAlignment = "Left"
$toggleButton.Style = $ToggleButtonStyle
[System.Windows.Automation.AutomationProperties]::SetName($toggleButton, $entryInfo.Content[0])
@@ -490,7 +490,7 @@ function Invoke-WPFUIElements {
$checkBox.Name = $entryInfo.Name
$checkBox.Content = $entryInfo.Content
$checkBox.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize")
$checkBox.ToolTip = $entryInfo.Description
$checkBox.ToolTip = Get-WinUtilEntryToolTip -Description $entryInfo.Description -Key $entryInfo.Name
$checkBox.SetResourceReference([Windows.Controls.Control]::MarginProperty, "CheckBoxMargin")
$checkBox.UseLayoutRounding = $true
[System.Windows.Automation.AutomationProperties]::SetName($checkBox, $entryInfo.Content)