From e2591250be97444f2a401d947708e1a50d99ea54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pol=C3=A1=C5=A1ek?= Date: Thu, 6 Nov 2025 01:34:16 +0100 Subject: [PATCH] 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. ## 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 ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed --- .../Commands/BuiltInsCommandProvider.cs | 4 ++-- .../Commands/MainListPage.cs | 7 ++++++- .../TimeDateCommandsProviderTests.cs | 2 +- .../WebSearchCommandProviderTests.cs | 2 +- .../SystemCommandExtensionProvider.cs | 4 ++-- .../TimeDateCommandsProvider.cs | 4 ++-- .../WebSearchCommandsProvider.cs | 4 ++-- .../WindowsSettingsCommandsProvider.cs | 4 ++-- 8 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs index 3a3a9bd405..c873ecf154 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/BuiltInsCommandProvider.cs @@ -11,7 +11,7 @@ namespace Microsoft.CmdPal.UI.ViewModels.BuiltinCommands; /// /// Built-in Provider for a top-level command which can quit the application. Invokes the , which sends a . /// -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"); } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs index ef7c879d36..996475d559 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs @@ -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; diff --git a/src/modules/cmdpal/Tests/Microsoft.CmdPal.Ext.TimeDate.UnitTests/TimeDateCommandsProviderTests.cs b/src/modules/cmdpal/Tests/Microsoft.CmdPal.Ext.TimeDate.UnitTests/TimeDateCommandsProviderTests.cs index 7553ca8321..f76ee253ca 100644 --- a/src/modules/cmdpal/Tests/Microsoft.CmdPal.Ext.TimeDate.UnitTests/TimeDateCommandsProviderTests.cs +++ b/src/modules/cmdpal/Tests/Microsoft.CmdPal.Ext.TimeDate.UnitTests/TimeDateCommandsProviderTests.cs @@ -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); } diff --git a/src/modules/cmdpal/Tests/Microsoft.CmdPal.Ext.WebSearch.UnitTests/WebSearchCommandProviderTests.cs b/src/modules/cmdpal/Tests/Microsoft.CmdPal.Ext.WebSearch.UnitTests/WebSearchCommandProviderTests.cs index c141d28d6e..ef8b56a1b8 100644 --- a/src/modules/cmdpal/Tests/Microsoft.CmdPal.Ext.WebSearch.UnitTests/WebSearchCommandProviderTests.cs +++ b/src/modules/cmdpal/Tests/Microsoft.CmdPal.Ext.WebSearch.UnitTests/WebSearchCommandProviderTests.cs @@ -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] diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/SystemCommandExtensionProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/SystemCommandExtensionProvider.cs index 54ec578dfa..4bc86c209d 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/SystemCommandExtensionProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.System/SystemCommandExtensionProvider.cs @@ -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) { diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/TimeDateCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/TimeDateCommandsProvider.cs index 26bd4d8453..0ad8c339ff 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/TimeDateCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.TimeDate/TimeDateCommandsProvider.cs @@ -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, diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchCommandsProvider.cs index 9087ce0ee1..1a15991120 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WebSearch/WebSearchCommandsProvider.cs @@ -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; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs index 600e621c99..dd13d5295a 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettingsCommandsProvider.cs @@ -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;