mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
CmdPal: Treat System command provider as special (#43321)
## Summary of the Pull Request This change marks the System command provider as special, ensuring fallback items are surfaced at the top of the list. Additionally, the SystemCommandExtensionProvider ID has been updated to comply with the new naming convention. As a small cleanup, SystemCommandExtensionProvider is now sealed. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] Related to: #42524 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
This commit is contained in:
@@ -11,7 +11,7 @@ namespace Microsoft.CmdPal.UI.ViewModels.BuiltinCommands;
|
||||
/// <summary>
|
||||
/// Built-in Provider for a top-level command which can quit the application. Invokes the <see cref="QuitCommand"/>, which sends a <see cref="QuitMessage"/>.
|
||||
/// </summary>
|
||||
public partial class BuiltInsCommandProvider : CommandProvider
|
||||
public sealed partial class BuiltInsCommandProvider : CommandProvider
|
||||
{
|
||||
private readonly OpenSettingsCommand openSettings = new();
|
||||
private readonly QuitCommand quitCommand = new();
|
||||
@@ -34,7 +34,7 @@ public partial class BuiltInsCommandProvider : CommandProvider
|
||||
|
||||
public BuiltInsCommandProvider()
|
||||
{
|
||||
Id = "Core";
|
||||
Id = "com.microsoft.cmdpal.builtin.core";
|
||||
DisplayName = Properties.Resources.builtin_display_name;
|
||||
Icon = IconHelpers.FromRelativePath("Assets\\StoreLogo.scale-200.png");
|
||||
}
|
||||
|
||||
@@ -30,7 +30,12 @@ public partial class MainListPage : DynamicListPage,
|
||||
{
|
||||
private readonly string[] _specialFallbacks = [
|
||||
"com.microsoft.cmdpal.builtin.run",
|
||||
"com.microsoft.cmdpal.builtin.calculator"
|
||||
"com.microsoft.cmdpal.builtin.calculator",
|
||||
"com.microsoft.cmdpal.builtin.system",
|
||||
"com.microsoft.cmdpal.builtin.core",
|
||||
"com.microsoft.cmdpal.builtin.websearch",
|
||||
"com.microsoft.cmdpal.builtin.windowssettings",
|
||||
"com.microsoft.cmdpal.builtin.datetime",
|
||||
];
|
||||
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Microsoft.CmdPal.Ext.TimeDate.UnitTests
|
||||
// Assert
|
||||
Assert.IsNotNull(provider);
|
||||
Assert.IsNotNull(provider.DisplayName);
|
||||
Assert.AreEqual("DateTime", provider.Id);
|
||||
Assert.AreEqual("com.microsoft.cmdpal.builtin.datetime", provider.Id);
|
||||
Assert.IsNotNull(provider.Icon);
|
||||
Assert.IsNotNull(provider.Settings);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class WebSearchCommandProviderTests
|
||||
var provider = new WebSearchCommandsProvider();
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual("WebSearch", provider.Id);
|
||||
Assert.AreEqual("com.microsoft.cmdpal.builtin.websearch", provider.Id);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
@@ -9,7 +9,7 @@ using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.System;
|
||||
|
||||
public partial class SystemCommandExtensionProvider : CommandProvider
|
||||
public sealed partial class SystemCommandExtensionProvider : CommandProvider
|
||||
{
|
||||
private readonly ICommandItem[] _commands;
|
||||
private static readonly SettingsManager _settingsManager = new();
|
||||
@@ -19,7 +19,7 @@ public partial class SystemCommandExtensionProvider : CommandProvider
|
||||
public SystemCommandExtensionProvider()
|
||||
{
|
||||
DisplayName = Resources.Microsoft_plugin_ext_system_page_name;
|
||||
Id = "System";
|
||||
Id = "com.microsoft.cmdpal.builtin.system";
|
||||
_commands = [
|
||||
new CommandItem(Page)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.TimeDate;
|
||||
|
||||
public partial class TimeDateCommandsProvider : CommandProvider
|
||||
public sealed partial class TimeDateCommandsProvider : CommandProvider
|
||||
{
|
||||
private readonly CommandItem _command;
|
||||
private static readonly SettingsManager _settingsManager = new SettingsManager();
|
||||
@@ -23,7 +23,7 @@ public partial class TimeDateCommandsProvider : CommandProvider
|
||||
public TimeDateCommandsProvider()
|
||||
{
|
||||
DisplayName = Resources.Microsoft_plugin_timedate_plugin_name;
|
||||
Id = "DateTime";
|
||||
Id = "com.microsoft.cmdpal.builtin.datetime";
|
||||
_command = new CommandItem(_timeDateExtensionPage)
|
||||
{
|
||||
Icon = _timeDateExtensionPage.Icon,
|
||||
|
||||
@@ -11,7 +11,7 @@ using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.WebSearch;
|
||||
|
||||
public partial class WebSearchCommandsProvider : CommandProvider
|
||||
public sealed partial class WebSearchCommandsProvider : CommandProvider
|
||||
{
|
||||
private readonly SettingsManager _settingsManager = new();
|
||||
private readonly FallbackExecuteSearchItem _fallbackItem;
|
||||
@@ -22,7 +22,7 @@ public partial class WebSearchCommandsProvider : CommandProvider
|
||||
|
||||
public WebSearchCommandsProvider()
|
||||
{
|
||||
Id = "WebSearch";
|
||||
Id = "com.microsoft.cmdpal.builtin.websearch";
|
||||
DisplayName = Resources.extension_name;
|
||||
Icon = Icons.WebSearch;
|
||||
Settings = _settingsManager.Settings;
|
||||
|
||||
@@ -10,7 +10,7 @@ using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.WindowsSettings;
|
||||
|
||||
public partial class WindowsSettingsCommandsProvider : CommandProvider
|
||||
public sealed partial class WindowsSettingsCommandsProvider : CommandProvider
|
||||
{
|
||||
private readonly CommandItem _searchSettingsListItem;
|
||||
|
||||
@@ -22,7 +22,7 @@ public partial class WindowsSettingsCommandsProvider : CommandProvider
|
||||
|
||||
public WindowsSettingsCommandsProvider()
|
||||
{
|
||||
Id = "Windows.Settings";
|
||||
Id = "com.microsoft.cmdpal.builtin.windowssettings";
|
||||
DisplayName = Resources.WindowsSettingsProvider_DisplayName;
|
||||
Icon = Icons.WindowsSettingsIcon;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user