[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:
Heiko 2021-11-10 17:38:27 +01:00 committed by GitHub
parent fb97ce040b
commit 2c9b86d873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 2079 additions and 1824 deletions

View File

@ -787,6 +787,7 @@ hmonitor
HOLDENTER
HOLDESC
homljgmgpmcbpjbnjpfijnhipfkiclkd
Homepage
HOOKPROC
hostname
hotkeycontrol

View File

@ -26,6 +26,7 @@ The `WindowsSettings.json` use a JSON schema file that make it easier to edit it
| `Note` | Yes | String | `Note` |
| `IntroducedInBuild` | Yes | Integer | |
| `DeprecatedInBuild` | Yes | Integer | |
| `ShowAsFirstResult` | Yes | Boolean | |
A minimum entry for the `WindowsSettings.json` looks like:
@ -48,7 +49,8 @@ A full entry for the `WindowsSettings.json` looks like:
"AltNames": [ "NiceSetting" ],
"Note": "NoteMySettingNote",
"IntroducedInBuild" : 1903,
"DeprecatedInBuild" : 2004
"DeprecatedInBuild" : 2004,
"ShowAsFirstResult" : true
}
```
@ -65,11 +67,12 @@ A full entry for the `WindowsSettings.json` looks like:
There are three different score types with different start values.
| Score type | Start value |
| ------------ | ------------ |
| High score | 10000 |
| Medium score | 5000 |
| Low score | 1000 |
| Score type | Start value |
| ------------------ | ------------ |
| First result score | 10500 |
| High score | 10000 |
| Medium score | 5000 |
| Low score | 1000 |
Each score will decreased by one when a condition match.
@ -83,6 +86,9 @@ Each score will decreased by one when a condition match.
| 6. | One alternative name of the settings starts with the search value | Medium score |
| x. | no condition match | Low score |
### Remarks
* For each score condition we check if the property "ShowAsFirstResult" of the setting is true. If yes we use the firstResultScore instead of condition`s score.
## Important for developers
### General

View File

@ -19,6 +19,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
Name = string.Empty;
Command = string.Empty;
Type = string.Empty;
ShowAsFirstResult = false;
}
/// <summary>
@ -62,6 +63,11 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
/// </summary>
public uint? DeprecatedInBuild { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to use a higher score as normal for this setting to show it as one of the first results.
/// </summary>
public bool ShowAsFirstResult { get; set; }
/// <summary>
/// Gets or sets the the value with the generated area path as string.
/// This Property IS NOT PART OF THE DATA IN "WindowsSettings.json".

View File

@ -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--;
}
}

View File

@ -447,15 +447,6 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Home page.
/// </summary>
internal static string AreaHomePage {
get {
return ResourceManager.GetString("AreaHomePage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Mixed reality.
/// </summary>
@ -510,6 +501,15 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Security and Maintenance.
/// </summary>
internal static string AreaSecurityAndMaintenance {
get {
return ResourceManager.GetString("AreaSecurityAndMaintenance", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to SurfaceHub.
/// </summary>
@ -537,6 +537,15 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to System Properties.
/// </summary>
internal static string AreaSystemPropertiesAdvanced {
get {
return ResourceManager.GetString("AreaSystemPropertiesAdvanced", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Time and language.
/// </summary>
@ -834,6 +843,15 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Change User Account Control settings.
/// </summary>
internal static string ChangeUACSettings {
get {
return ResourceManager.GetString("ChangeUACSettings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Choose which folders appear on Start.
/// </summary>
@ -1230,6 +1248,15 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Edit environment variables.
/// </summary>
internal static string EditEnvironmentVariables {
get {
return ResourceManager.GetString("EditEnvironmentVariables", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Edition.
/// </summary>
@ -1239,6 +1266,24 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Edit the system environment variables.
/// </summary>
internal static string EditSystemEnvironmentVariables {
get {
return ResourceManager.GetString("EditSystemEnvironmentVariables", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Edit environment variables for your account.
/// </summary>
internal static string EditUserEnvironmentVariables {
get {
return ResourceManager.GetString("EditUserEnvironmentVariables", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Email.
/// </summary>
@ -1275,6 +1320,15 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Env vars.
/// </summary>
internal static string EnvVars {
get {
return ResourceManager.GetString("EnvVars", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Ethernet.
/// </summary>
@ -2211,6 +2265,15 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Editing this setting may require administrative privileges..
/// </summary>
internal static string NoteEditingRequireAdminPrivileges {
get {
return ResourceManager.GetString("NoteEditingRequireAdminPrivileges", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Only present if user is enrolled in WIP..
/// </summary>
@ -2436,6 +2499,24 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Control Panel (Application homepage).
/// </summary>
internal static string OpenControlPanel {
get {
return ResourceManager.GetString("OpenControlPanel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Settings (Application homepage).
/// </summary>
internal static string OpenSettingsApp {
get {
return ResourceManager.GetString("OpenSettingsApp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to OS.
/// </summary>
@ -3094,11 +3175,11 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
/// <summary>
/// Looks up a localized string similar to Settings home page.
/// Looks up a localized string similar to Settings app.
/// </summary>
internal static string SettingsHomePage {
internal static string SettingsApp {
get {
return ResourceManager.GetString("SettingsHomePage", resourceCulture);
return ResourceManager.GetString("SettingsApp", resourceCulture);
}
}
@ -3300,6 +3381,15 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to System env vars.
/// </summary>
internal static string SystemEnvVars {
get {
return ResourceManager.GetString("SystemEnvVars", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to System properties and Add New Hardware wizard.
/// </summary>
@ -3309,6 +3399,15 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to System variables.
/// </summary>
internal static string SystemVariables {
get {
return ResourceManager.GetString("SystemVariables", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Tab.
/// </summary>
@ -3516,6 +3615,15 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to UAC.
/// </summary>
internal static string UAC {
get {
return ResourceManager.GetString("UAC", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Uninstall.
/// </summary>
@ -3534,6 +3642,15 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to UserAccountControlSettings.exe.
/// </summary>
internal static string UserAccountControlSettings_exe {
get {
return ResourceManager.GetString("UserAccountControlSettings.exe", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to User accounts.
/// </summary>
@ -3543,6 +3660,33 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to User environment variables.
/// </summary>
internal static string UserEnvironmentVariables {
get {
return ResourceManager.GetString("UserEnvironmentVariables", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to User env vars.
/// </summary>
internal static string UserEnvVars {
get {
return ResourceManager.GetString("UserEnvVars", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to User variables.
/// </summary>
internal static string UserVariables {
get {
return ResourceManager.GetString("UserVariables", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Version.
/// </summary>

View File

@ -275,9 +275,6 @@
<data name="AreaHardwareAndSound" xml:space="preserve">
<value>Hardware and Sound</value>
</data>
<data name="AreaHomePage" xml:space="preserve">
<value>Home page</value>
</data>
<data name="AreaMixedReality" xml:space="preserve">
<value>Mixed reality</value>
</data>
@ -296,6 +293,10 @@
<data name="AreaPrograms" xml:space="preserve">
<value>Programs</value>
</data>
<data name="AreaSecurityAndMaintenance" xml:space="preserve">
<value>Security and Maintenance</value>
<comment>Area Security and Maintenance in legacy Control Panel app.</comment>
</data>
<data name="AreaSurfaceHub" xml:space="preserve">
<value>SurfaceHub</value>
</data>
@ -305,6 +306,10 @@
<data name="AreaSystemAndSecurity" xml:space="preserve">
<value>System and Security</value>
</data>
<data name="AreaSystemPropertiesAdvanced" xml:space="preserve">
<value>System Properties</value>
<comment>System Properties dialog sysdm.cpl</comment>
</data>
<data name="AreaTimeAndLanguage" xml:space="preserve">
<value>Time and language</value>
</data>
@ -428,6 +433,9 @@
<value>Cellular and SIM</value>
<comment>Area NetworkAndInternet</comment>
</data>
<data name="ChangeUACSettings" xml:space="preserve">
<value>Change User Account Control settings</value>
</data>
<data name="ChooseWhichFoldersAppearOnStart" xml:space="preserve">
<value>Choose which folders appear on Start</value>
<comment>Area Personalization</comment>
@ -599,10 +607,20 @@
<value>Ease of access center</value>
<comment>Area Control Panel (legacy settings)</comment>
</data>
<data name="EditEnvironmentVariables" xml:space="preserve">
<value>Edit environment variables</value>
<comment>Used as AltName on EditSystemEnvironmentVars settings to make both entries available via 'Edit environment variables'.</comment>
</data>
<data name="Edition" xml:space="preserve">
<value>Edition</value>
<comment>Means the "Windows Edition"</comment>
</data>
<data name="EditSystemEnvironmentVariables" xml:space="preserve">
<value>Edit the system environment variables</value>
</data>
<data name="EditUserEnvironmentVariables" xml:space="preserve">
<value>Edit environment variables for your account</value>
</data>
<data name="Email" xml:space="preserve">
<value>Email</value>
<comment>Area Privacy</comment>
@ -619,6 +637,10 @@
<value>Environment</value>
<comment>Area MixedReality, only available if the Mixed Reality Portal app is installed.</comment>
</data>
<data name="EnvVars" xml:space="preserve">
<value>Env vars</value>
<comment>Short english form. Don't translate!</comment>
</data>
<data name="Ethernet" xml:space="preserve">
<value>Ethernet</value>
<comment>Area NetworkAndInternet</comment>
@ -1009,6 +1031,9 @@
<data name="NoteDisplayGraphics" xml:space="preserve">
<value>Only available on devices that support advanced display options.</value>
</data>
<data name="NoteEditingRequireAdminPrivileges" xml:space="preserve">
<value>Editing this setting may require administrative privileges.</value>
</data>
<data name="NoteEnrolledWIP" xml:space="preserve">
<value>Only present if user is enrolled in WIP.</value>
</data>
@ -1094,6 +1119,14 @@
<data name="OnScreen" xml:space="preserve">
<value>On-Screen</value>
</data>
<data name="OpenControlPanel" xml:space="preserve">
<value>Control Panel (Application homepage)</value>
<comment>'Control Panel' is here the name of the legacy settings app.</comment>
</data>
<data name="OpenSettingsApp" xml:space="preserve">
<value>Settings (Application homepage)</value>
<comment>'Settings' is here the name of the modern settings app.</comment>
</data>
<data name="Os" xml:space="preserve">
<value>OS</value>
<comment>Means the "Operating System"</comment>
@ -1373,9 +1406,8 @@
<value>Session cleanup</value>
<comment>Area SurfaceHub</comment>
</data>
<data name="SettingsHomePage" xml:space="preserve">
<value>Settings home page</value>
<comment>Area Home, Overview-page for all areas of settings </comment>
<data name="SettingsApp" xml:space="preserve">
<value>Settings app</value>
</data>
<data name="SetUpKiosk" xml:space="preserve">
<value>Set up a kiosk</value>
@ -1462,10 +1494,17 @@
<value>System</value>
<comment>Area Control Panel (legacy settings)</comment>
</data>
<data name="SystemEnvVars" xml:space="preserve">
<value>System env vars</value>
<comment>Short english form. Don't translate!</comment>
</data>
<data name="SystemPropertiesAndAddNewHardwareWizard" xml:space="preserve">
<value>System properties and Add New Hardware wizard</value>
<comment>Area Control Panel (legacy settings)</comment>
</data>
<data name="SystemVariables" xml:space="preserve">
<value>System variables</value>
</data>
<data name="Tab" xml:space="preserve">
<value>Tab</value>
<comment>Means the key "Tabulator" on the keyboard</comment>
@ -1552,6 +1591,10 @@
<value>Typing</value>
<comment>Area Device</comment>
</data>
<data name="UAC" xml:space="preserve">
<value>UAC</value>
<comment>Short version of 'User account control'</comment>
</data>
<data name="Uninstall" xml:space="preserve">
<value>Uninstall</value>
<comment>Area MixedReality, only available if the Mixed Reality Portal app is installed.</comment>
@ -1560,10 +1603,24 @@
<value>USB</value>
<comment>Area Device</comment>
</data>
<data name="UserAccountControlSettings.exe" xml:space="preserve">
<value>UserAccountControlSettings.exe</value>
<comment>Name of the executable</comment>
</data>
<data name="UserAccounts" xml:space="preserve">
<value>User accounts</value>
<comment>Area Control Panel (legacy settings)</comment>
</data>
<data name="UserEnvironmentVariables" xml:space="preserve">
<value>User environment variables</value>
</data>
<data name="UserEnvVars" xml:space="preserve">
<value>User env vars</value>
<comment>Short english form. Don't translate!</comment>
</data>
<data name="UserVariables" xml:space="preserve">
<value>User variables</value>
</data>
<data name="Version" xml:space="preserve">
<value>Version</value>
<comment>Means The "Windows Version"</comment>

View File

@ -1,65 +1,73 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"additionalProperties": false,
"required": [ "Settings" ],
"properties": {
"Settings": {
"description": "A list with all possible windows settings.",
"$schema": "http://json-schema.org/draft-04/schema",
"additionalProperties": false,
"required": [ "Settings" ],
"properties": {
"$schema": {
"description": "Path to the schema file.",
"type": "string"
},
"Settings": {
"description": "A list with all possible windows settings.",
"type": "array",
"items": {
"additionalProperties": false,
"required": [ "Name", "Command", "Type" ],
"type": "object",
"properties": {
"Name": {
"description": "The name of this setting.",
"type": "string"
},
"Areas": {
"description": "A list of areas of this setting",
"type": "array",
"items": {
"additionalProperties": false,
"required": [ "Name", "Command", "Type" ],
"type": "object",
"properties": {
"Name": {
"description": "The name of this setting.",
"type": "string"
},
"Areas": {
"description": "A list of areas of this setting",
"type": "array",
"items": {
"description": "A area of this setting",
"type": "string",
"pattern": "^Area"
}
},
"Type": {
"description": "The type of this setting.",
"type": "string",
"pattern": "^App"
},
"AltNames": {
"description": "A list with alternative names for this setting",
"type": "array",
"items": {
"description": "A alternative name for this setting",
"type": "string"
}
},
"Command": {
"description": "The command for this setting.",
"type": "string"
},
"Note": {
"description": "A additional note for this setting.",
"type": "string",
"pattern": "^Note"
},
"DeprecatedInBuild": {
"description": "The Windows build since this settings is not longer present.",
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
"IntroducedInBuild": {
"description": "The minimum need Windows build for this setting.",
"type": "integer",
"minimum": 0,
"maximum": 4294967295
}
}
"description": "A area of this setting",
"type": "string",
"pattern": "^Area"
}
},
"Type": {
"description": "The type of this setting.",
"type": "string",
"pattern": "^App"
},
"AltNames": {
"description": "A list with alternative names for this setting",
"type": "array",
"items": {
"description": "A alternative name for this setting",
"type": "string"
}
},
"Command": {
"description": "The command for this setting.",
"type": "string"
},
"Note": {
"description": "A additional note for this setting.",
"type": "string",
"pattern": "^Note"
},
"DeprecatedInBuild": {
"description": "The Windows build since this settings is not longer present.",
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
"IntroducedInBuild": {
"description": "The minimum need Windows build for this setting.",
"type": "integer",
"minimum": 0,
"maximum": 4294967295
},
"ShowAsFirstResult": {
"description": "Use a higher score as normal for this setting to show it as one of the first results.",
"type": "boolean"
}
}
}
}
}
}