Command Palette Extensions
Command Palette (CmdPal) is the next-generation launcher for PowerToys, designed with extensibility as a core principle. Unlike PowerToys Run plugins, Command Palette extensions are WinRT-based and language-agnostic, allowing developers to create rich, interactive experiences.Command Palette is currently in preview. The API may introduce breaking changes before reaching v1.0.0.
Extension Architecture
Command Palette extensions are built on Windows Runtime (WinRT) components, making them accessible from any language that supports WinRT interfaces including C#, C++/WinRT, Rust, and more.Core Components
- IExtension - Entry point for extensions
- ICommandProvider - Provides commands and pages
- IListPage - Display searchable lists of items
- IContentPage - Display rich content (forms, markdown, trees)
- ICommand - Individual commands and actions
- IExtensionHost - Host APIs for status, logging, and notifications
Creating Your First Extension
Quick Start: Using the Command Palette
The fastest way to create an extension:- Open Command Palette (Win+Alt+Space)
- Type “Create extension”
- Enter your project name and display name
- Choose a location for your project
- Open the generated
.slnfile in Visual Studio
Manual Project Setup
If you prefer to create the project manually:- Create a Windows Runtime Component project in Visual Studio
- Target Windows 10.0.22621.0 or higher
- Add references:
Microsoft.CommandPalette.ExtensionsMicrosoft.CommandPalette.Extensions.Toolkit(C# helper library)
Extension SDK Reference
IExtension Interface
The main entry point for your extension:ICommandProvider Interface
Provides commands and pages to the Command Palette:src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.idl
IListPage Interface
Display searchable lists of items:src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.idl
ICommand Result Types
Commands return results that control navigation:src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.idl
Building a Simple Extension
Here’s a complete example of a basic Command Palette extension:Extension Entry Point
Command Provider
List Page
Real-World Example: Calculator Extension
Here’s a simplified version of the Calculator extension:src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs
- Top-level command for main calculator page
- Fallback command for evaluating math expressions typed anywhere
- Settings page accessible via context menu
- Icon configuration for light/dark themes
Advanced Features
Form Pages
Create interactive forms using Adaptive Cards JSON:Markdown Content
Display formatted markdown:Dynamic Filtering
ImplementIDynamicListPage for server-side filtering:
Extension Host APIs
Use host APIs for status updates and logging:Toolkit Helpers (C#)
TheMicrosoft.CommandPalette.Extensions.Toolkit provides useful C# helper classes:
CommandProvider Base Class
AnonymousCommand
Quick command creation:CommandResult Helpers
Testing Extensions
Local Testing
- Build your extension in Visual Studio
- Deploy to Command Palette:
- Build sets up the extension automatically
- Or manually copy to extensions folder
- Restart Command Palette:
- Close Command Palette if open
- Reopen with Win+Alt+Space
Debug Extensions
- Set breakpoints in your extension code
- In Visual Studio: Debug > Attach to Process
- Select
Microsoft.CmdPal.UI.exe - Open Command Palette and trigger your extension
Extension Packaging
Extensions can be packaged and distributed:- Build in Release mode
- Package files:
- Extension DLL
- Dependencies
- Assets (icons, etc.)
- Create installer or distribution package
- Provide installation instructions
API Evolution
Command Palette uses versioned APIs:src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions/Microsoft.CommandPalette.Extensions.idl
Best Practices
-
Performance
- Keep
GetItems()fast (< 100ms) - Use
IDynamicListPagefor expensive searches - Implement
LoadMore()for large datasets
- Keep
-
User Experience
- Provide clear titles and subtitles
- Use appropriate icons
- Show loading states for long operations
- Handle errors gracefully
-
Resource Management
- Implement proper disposal in
IExtension.Dispose() - Unsubscribe from events
- Clean up background tasks
- Implement proper disposal in
-
Accessibility
- Provide keyboard shortcuts where appropriate
- Use semantic command names
- Support high contrast themes
Resources
- Official Command Palette Documentation
- Example Extensions in Source
- WinRT API Reference
- Community Extension Examples
Next Steps
Explore Example Extensions
Check out the built-in extensions in the PowerToys source code for real-world examples
Join the Community
Share your extensions and get help from other developers