mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
[PT Run] [Settings plugin] Add new settings (#13746)
* Add entries for settings tools (#13741) * Add UAC entry (#13743) * fix typo * Add entries for environment vars (#13734) * fix typos * fixes * Improvements * fix resource strings * Fix merge conflicts * update system env vars command * fix json schema * Update settings * fix typo * add firstResultScore * fix typos
This commit is contained in:
@@ -146,6 +146,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
||||
var lowScore = 1_000;
|
||||
var mediumScore = 5_000;
|
||||
var highScore = 10_000;
|
||||
var firstResultScore = 10_500;
|
||||
|
||||
foreach (var result in resultList)
|
||||
{
|
||||
@@ -158,43 +159,44 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
||||
{
|
||||
if (windowsSetting.Name.StartsWith(query, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
result.Score = highScore--;
|
||||
result.Score = !windowsSetting.ShowAsFirstResult ? highScore-- : firstResultScore--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// If query starts with second or next word of name, set score.
|
||||
if (windowsSetting.Name.Contains($" {query}", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
result.Score = mediumScore--;
|
||||
result.Score = !windowsSetting.ShowAsFirstResult ? mediumScore-- : firstResultScore--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (windowsSetting.Areas is null)
|
||||
{
|
||||
result.Score = lowScore--;
|
||||
result.Score = !windowsSetting.ShowAsFirstResult ? lowScore-- : firstResultScore--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (windowsSetting.Areas.Any(x => x.StartsWith(query, StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
result.Score = lowScore--;
|
||||
result.Score = !windowsSetting.ShowAsFirstResult ? lowScore-- : firstResultScore--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (windowsSetting.AltNames is null)
|
||||
{
|
||||
result.Score = lowScore--;
|
||||
result.Score = !windowsSetting.ShowAsFirstResult ? lowScore-- : firstResultScore--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (windowsSetting.AltNames.Any(x => x.StartsWith(query, StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
result.Score = mediumScore--;
|
||||
result.Score = !windowsSetting.ShowAsFirstResult ? mediumScore-- : firstResultScore--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
result.Score = lowScore--;
|
||||
// On empty queries
|
||||
result.Score = !windowsSetting.ShowAsFirstResult ? lowScore-- : firstResultScore--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user