Skip to content

Commit f8cbcf5

Browse files
committed
oh my there's gonna be a lot
1 parent 099cd48 commit f8cbcf5

File tree

9 files changed

+233
-61
lines changed

9 files changed

+233
-61
lines changed

Diff for: hub/dev-environment/toc.yml

+20-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,26 @@ items:
127127
href: ../powertoys/command-palette/overview.md
128128
- name: Developer docs
129129
items:
130-
- name: Creating an extension
131-
href: ../powertoys/command-palette/creating-an-extension.md
130+
- name: Extensibility overview
131+
href: ../powertoys/command-palette/extensibility-overview.md
132+
- name: Authoring extensions
133+
items:
134+
- name: Creating an extension
135+
href: ../powertoys/command-palette/creating-an-extension.md
136+
- name: Update a list of commands
137+
href: ../powertoys/command-palette/update-a-list-of-commands.md
138+
- name: Command results
139+
href: ../powertoys/command-palette/command-results.md
140+
- name: Add top-level commands to your extension
141+
href: ../powertoys/command-palette/add-top-level-commands-to-your-extension.md
142+
- name: Display markdown content
143+
href: ../powertoys/command-palette/using-markdown-content.md
144+
- name: Get user input with forms
145+
href: ../powertoys/command-palette/using-form-pages.md
146+
- name: Handle the search text
147+
href: ../powertoys/command-palette/dynamic-lists.md
148+
- name: "Advanced: Adding an extension to your package"
149+
href: ../powertoys/command-palette/adding-an-extension-to-your-package.md
132150
- name: Publishing your extension
133151
href: ../powertoys/command-palette/publish-extension.md
134152
- name: Extension samples

Diff for: hub/images/command-palette/create-extension-page.png

212 KB
Loading
14.2 KB
Loading

Diff for: hub/powertoys/command-palette/creating-an-extension.md

+75-43
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,86 @@ no-loc: [PowerToys, Windows, Insider]
77
# Customer intent: As a Windows developer, I want to learn how to develop an extension for the Command Palette.
88
---
99

10-
# Extensibility overview
11-
12-
The Command Palette provides a full extension model, allowing developers to create their own experiences for the palette. This document provides information about how to create an extension and publish it. It also includes a sample extension that demonstrates the extensibility model.
13-
14-
## Registering your extension
15-
16-
Extensions can register themselves with the Command Palette using their `.appxmanifest`. As an example:
17-
18-
```xml
19-
<Extensions>
20-
<com:Extension Category="windows.comServer">
21-
<com:ComServer>
22-
<com:ExeServer Executable="ExtensionName.exe" Arguments="-RegisterProcessAsComServer" DisplayName="Sample Extension">
23-
<com:Class Id="<Extension CLSID Here>" DisplayName="Sample Extension" />
24-
</com:ExeServer>
25-
</com:ComServer>
26-
</com:Extension>
27-
<uap3:Extension Category="windows.appExtension">
28-
<uap3:AppExtension Name="com.microsoft.commandpalette"
29-
Id="YourApplicationUniqueId"
30-
PublicFolder="Public"
31-
DisplayName="Sample Extension"
32-
Description="Sample Extension for Run">
33-
<uap3:Properties>
34-
<CmdPalProvider>
35-
<Activation>
36-
<CreateInstance ClassId="<Extension CLSID Here>" />
37-
</Activation>
38-
<SupportedInterfaces>
39-
<Commands />
40-
</SupportedInterfaces>
41-
</CmdPalProvider>
42-
</uap3:Properties>
43-
</uap3:AppExtension>
44-
</uap3:Extension>
45-
</Extensions>
10+
# Creating an extension
11+
12+
The fastest way to get started writing extensions is from the Command Palette itself. Just run the "Create a new extension" command, fill out the fields to populate the template project, and you should be ready to start.
13+
14+
The form will ask you for the following information:
15+
* **ExtensionName**: The name of your extension. This will be used as the name of the project and the name of the class that implements your commands. Make sure it's a valid C# class name - it shouldn't have any spaces or special characters, and should start with a capital letter.
16+
* **Extension Display Name**: The name of your extension as it will appear in the Command Palette. This can be a more human-readable name.
17+
* **Output Path**: The folder where the project will be created.
18+
* The project will be created in a subdirectory of the path you provided.
19+
* If this path doesn't exist, it will be created for you.
20+
21+
![](../../images/command-palette/create-extension-page.png)
22+
23+
Once you submit the form, Command Palette will automatically generate the project for you. At this point, your projects structure should look like the following:
24+
25+
```plaintext
26+
ExtensionName/
27+
│ Directory.Build.props
28+
│ Directory.Packages.props
29+
│ nuget.config
30+
│ ExtensionName.sln
31+
└───ExtensionName
32+
│ app.manifest
33+
│ Package.appxmanifest
34+
│ Program.cs
35+
│ ExtensionName.cs
36+
│ ExtensionName.csproj
37+
│ ExtensionNameCommandsProvider.cs
38+
├───Assets
39+
│ <A bunch of placeholder images>
40+
├───Pages
41+
│ ExtensionNamePage.cs
42+
└───Properties
43+
│ launchSettings.json
44+
└───PublishProfiles
45+
win-arm64.pubxml
46+
win-x64.pubxml
4647
```
4748

48-
### Important notes
49+
(with `ExtensionName` replaced with the name you provided)
50+
51+
From here, you can immediately build the project and run it. Once your package is deployed and running, Command Palette will automatically discover your extension and load it into the palette.
52+
53+
> [!TIP]
54+
> Make sure you deploy your app! Just **build**ing your application won't update the package in the same way that deploying it will.
55+
56+
> [!WARNING]
57+
> Running "ExtensionName (Unpackaged)" from Visual Studio will not **deploy** your app package.
58+
59+
You should be able to see your extension in the Command Palette at the end of the list of commands. Entering that command should take you to the page for your command, and you should see a single command that says "TODO: Implement your extension here".
60+
61+
![](../../images/command-palette/initial-created-extension-list.png)
62+
63+
Congrats! You've made your first extension! Now let's go ahead and actually add some commands to it.
64+
65+
When you make changes to your extension, you can rebuild your project and deploy it again. Command Palette will **not** notice changes to packages that are re-ran through Visual Studio, so you'll need to manually run the "**Reload**" command to force Command Palette to re-instantiate your extension.
66+
67+
Let's make that command do something.
68+
69+
We can start by navigating to the `ExtensionNamePage.cs` file. This file is the [`ListPage`](./microsoft-commandpalette-extensions-toolkit/listpage.md) that will be displayed when the user selects your extension. In there you should see:
70+
71+
```csharp
72+
public DocsSamplePage()
73+
{
74+
Icon = IconHelpers.FromRelativePath("Assets\\StoreLogo.png");
75+
Title = "My sample extension";
76+
Name = "Open";
77+
}
78+
public override IListItem[] GetItems()
79+
{
80+
return [
81+
new ListItem(new NoOpCommand()) { Title = "TODO: Implement your extension here" }
82+
];
83+
}
84+
```
4985

50-
Some notable elements about the manifest example:
86+
https://learn.microsoft.com/windows/powertoys/command-palette/overview
5187

52-
- The application must specify a `Extensions.comExtension.ComServer` to host their COM class. This allows for the OS to register that GUID as a COM class we can instantiate.
53-
- Make sure that this CLSID is unique, and matches the one in your application
54-
- The application must specify a `Extensions.uap3Extension.AppExtension` with the Name set to `com.microsoft.commandpalette`. This is the unique identifier which DevPal can use to find it's extensions.
55-
- In the `Properties` of your `AppExtension`, you must specify a `CmdPalProvider` element. This is where you specify the CLSID of the COM class that DevPal will instantiate to interact with your extension. Also, you specify which interfaces you support.
5688

57-
Currently, only `Commands` is supported. If we need to add more in the future, they will be added to the `SupportedInterfaces` element.
89+
### Next up: [Update a list of commands](update-a-list-of-commands.md)
5890

5991
## Related content
6092

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Command Palette Extensibility
3+
description: The Command Palette provides a full extension model, allowing you to create custom experiences for the palette. Learn how to create an extension and publish it.
4+
ms.date: 2/28/2025
5+
ms.topic: concept-article
6+
no-loc: [PowerToys, Windows, Insider]
7+
# Customer intent: As a Windows developer, I want to learn how to develop an extension for the Command Palette.
8+
---
9+
10+
# Extensibility overview
11+
12+
The Command Palette provides a full extension model, allowing developers to create their own experiences for the palette.
13+
14+
The fastest way to get started writing extensions is from the Command Palette itself. Just run the "Create a new extension" command, fill out the fields to populate the template project, and you should be ready to start.
15+
16+
For more detailed instructions, you can follow these pages:
17+
18+
* [Creating an extension](../powertoys/command-palette/creating-an-extension.md)
19+
* [Update a list of commands](../powertoys/command-palette/update-a-list-of-commands.md)
20+
* [Command results](../powertoys/command-palette/command-results.md)
21+
* [Add top-level commands to your extension](../powertoys/command-palette/add-top-level-commands-to-your-extension.md)
22+
* [Display markdown content](../powertoys/command-palette/using-markdown-content.md)
23+
* [Get user input with forms](../powertoys/command-palette/using-form-pages.md)
24+
* [Handle the search text](../powertoys/command-palette/dynamic-lists.md)
25+
* [Advanced: Adding an extension to your package](../powertoys/command-palette/adding-an-extension-to-your-package.md)
26+
27+
28+
## Extension details
29+
30+
Command Palette defines a WinRT API ([`Microsoft.CommandPalette.Extensions`](./microsoft-commandpalette-extensions/microsoft-commandpalette-extensions.md)), which is how extensions can communicate with Command Palette.
31+
32+
Command Palette will use the Package Catalog to find apps that list themselves as an `windows.appExtension` for `com.microsoft.commandpalette`.
33+
34+
### Registering your extension
35+
36+
Extensions can register themselves with the Command Palette using their `.appxmanifest`. As an example:
37+
38+
```xml
39+
<Extensions>
40+
<com:Extension Category="windows.comServer">
41+
<com:ComServer>
42+
<com:ExeServer Executable="ExtensionName.exe" Arguments="-RegisterProcessAsComServer" DisplayName="Sample Extension">
43+
<com:Class Id="<Extension CLSID Here>" DisplayName="Sample Extension" />
44+
</com:ExeServer>
45+
</com:ComServer>
46+
</com:Extension>
47+
<uap3:Extension Category="windows.appExtension">
48+
<uap3:AppExtension Name="com.microsoft.commandpalette"
49+
Id="YourApplicationUniqueId"
50+
PublicFolder="Public"
51+
DisplayName="Sample Extension"
52+
Description="Sample Extension for Command Palette">
53+
<uap3:Properties>
54+
<CmdPalProvider>
55+
<Activation>
56+
<CreateInstance ClassId="<Extension CLSID Here>" />
57+
</Activation>
58+
<SupportedInterfaces>
59+
<Commands />
60+
</SupportedInterfaces>
61+
</CmdPalProvider>
62+
</uap3:Properties>
63+
</uap3:AppExtension>
64+
</uap3:Extension>
65+
</Extensions>
66+
```
67+
68+
In this manifest, we're using an out-of-process COM server to act as the communication layer between your app and Command Palette. **Don't worry about this**! The template project will take care of creating a COM server for you, starting it, and marshalling your objects to Command Palette.
69+
70+
### Important notes
71+
72+
Some notable elements about the manifest example:
73+
74+
- The application must specify a `Extensions.uap3Extension.AppExtension` with the Name set to `com.microsoft.commandpalette`. This is the unique identifier which Command Palette uses to find it's extensions.
75+
- The application must specify a `Extensions.comExtension.ComServer` to host their COM class. This allows for the OS to register that GUID as a COM class we can instantiate.
76+
- Make sure that this CLSID is unique, and matches the one in your application. If you change one, you need to change all three.
77+
- In the `Properties` of your `AppExtension`, you must specify a `CmdPalProvider` element. This is where you specify the CLSID of the COM class that Command Palette will instantiate to interact with your extension.
78+
- Currently, only `Commands` is supported.
79+
80+
## Related content
81+
82+
- [PowerToys Command Palette utility](overview.md)
83+
- [Extension samples](samples.md)

Diff for: hub/powertoys/command-palette/microsoft-commandpalette-extensions/microsoft-commandpalette-extensions.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ no-loc: [PowerToys, Windows, Insider]
1010

1111
Contains the interfaces to create extensions for the Command Palette.
1212

13+
These are the raw WinRT interfaces that Command Palette uses to communicate with your extension. These can be implemented however you'd like, in any language that supports implementing WinRT interfaces. For simplicity, there's a reference C# implementation of these interfaces in the [`Microsoft.CommandPalette.Extensions.Toolkit`](../microsoft-commandpalette-extensions-toolkit/microsoft-commandpalette-extensions-toolkit.md) namespace.
14+
1315
## Structs
1416

1517
| Struct | Description |

Diff for: hub/powertoys/command-palette/overview.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ To use the Command Palette, select <kbd>Win</kbd>+<kbd>Alt</kbd>+<kbd>Space</kbd
2121
Command Palette features include:
2222

2323
- Search for applications, folders or files
24-
- Search for running processes (previously known as [Window Walker](https://github.com/betsegaw/windowwalker/))
25-
- Invoke Shell Plugin using `>` (for example, `> Shell:startup` will open the Windows startup folder)
24+
- Run commands using `>` (for example, `> cmd` will launch Command prompt, or `> Shell:startup` will open the Windows startup folder)
25+
- Switch between open windows (previously known as [Window Walker](https://github.com/betsegaw/windowwalker/))
2626
- Do a simple calculation using calculator
2727
- Add bookmarks for frequently visited webpages
2828
- Execute system commands
2929
- Open web pages or start a web search
30+
- Rich extensions to add additional commands and features easily
3031

3132
## Settings
3233

@@ -44,5 +45,5 @@ The following general options are available within the Command Palette settings
4445
## Related content
4546

4647
- [PowerToys Run](../run.md)
47-
- [Extensibility overview](creating-an-extension.md)
48+
- [Extensibility overview](extensibility-overview.md)
4849
- [Extension samples](samples.md)

Diff for: hub/powertoys/command-palette/publish-extension.md

+33-5
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,52 @@ no-loc: [PowerToys, Windows, Insider]
1111

1212
The Command Palette provides a full extension model, allowing developers to create their own experiences for the palette. This document provides information about how to publish an extension.
1313

14-
There is a "Sample Project" template included with the Command Palette. This can be used to quickly generate a project that creates a new extension. This will include the `.sln`, `.csproj`, and `.appxmanifest` files needed to create a new extension, as well as the plumbing to get it ready to be published. You will then open the project to the **MyCommandProvider** class and implement your commands.
14+
There is a "Sample Project" template included with the Command Palette. This can be used to quickly generate a project that creates a new extension. This will include the `.sln`, `.csproj`, and `.appxmanifest` files needed to create a new extension, as well as the plumbing to get it ready to be published. You will then open the project to the `{ExtensionName}CommandsProvider` class (where `{ExtensionName}` is replaced with the name of your extension project) and implement your commands.
1515

1616
## Pre-requisites
1717

1818
The following tools are required to build and publish your extension:
1919

2020
- [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) (Community, Professional, or Enterprise edition)
2121

22+
## WinGet
23+
24+
Publishing packages to WinGet is the recommended way to share your extensions with users. Extension packages which are listed on WinGet can be discovered and installed directly from the Command Palette.
25+
26+
For the most part, following the steps on [Submit packages to Windows Package Manager](https://learn.microsoft.com/en-us/windows/package-manager/package/) will get your extension onto WinGet itself.
27+
28+
Before submitting your manifest to WinGet, you'll need to check two things:
29+
30+
### Add `windows-commandpalette-extension` tag
31+
32+
### Ensure WindowsAppSdk is listed as a dependency
33+
34+
If you're using Windows App SDK, then you'll need to make sure that it is listed as a dependency of your package
35+
36+
If you're not using the template project, then this may not apply to you.
37+
38+
<!--
39+
40+
Some day soon:
41+
42+
As a part of the project template, there's a WinGet GitHub Actions workflow that allows you to publish your extension to the WinGet repository with the necessary tags to make it discoverable by the Command Palette. So, you don't need to understand the details of packaging. You add the extension to your GitHub repository and let the your GitHub Actions pipeline handle the publishing.
43+
44+
-->
45+
2246
## Microsoft Store
2347

24-
Command Palette extensions can be published to the Microsoft Store. The process is similar to publishing other apps or extensions. You create a new submission in the Partner Center and upload your `.appx` package. The Command Palette automatically discovers your extension when it's installed from the Microsoft Store.
48+
Command Palette extensions can be published to the Microsoft Store. The process is similar to publishing other apps or extensions. You create a new submission in the Partner Center and upload your `.msix` package. The Command Palette automatically discovers your extension when it's installed from the Microsoft Store.
2549

26-
## WinGet
50+
Command Palette cannot, however, search for & install extensions that are only listed in the store. You can find those by running the following command:
51+
52+
```cmd
53+
ms-windows-store://assoc/?Tags=AppExtension-com.microsoft.commandpalette
54+
```
2755

28-
As a part of the project template, there's a WinGet GitHub Actions workflow that allows you to publish your extension to the WinGet repository with the necessary tags to make it discoverable by the Command Palette. So, you don't need to understand the details of packaging. You add the extension to your GitHub repository and let the your GitHub Actions pipeline handle the publishing.
56+
You can run this from the "Run commands" command in Command Palette, or from the command-line, or from the Run dialog.
2957

3058
## Related content
3159

32-
- [Extensibility overview](creating-an-extension.md)
60+
- [Extensibility overview](extensibility-overview.md)
3361
- [Extension samples](samples.md)
3462
- [PowerToys Command Palette utility](overview.md)

0 commit comments

Comments
 (0)