Add a README (#538)

Also fix one bug with the bookmarks and quit extensions
This commit is contained in:
Mike Griese
2025-03-12 06:55:46 -05:00
committed by GitHub
parent 2bb66b5404
commit ffab2db1f9
10 changed files with 95 additions and 16 deletions

View File

@@ -11,6 +11,6 @@
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.6.250205002" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="System.Text.Json" Version="9.0.2" />
<PackageVersion Include="System.Text.Json" Version="9.0.3" />
</ItemGroup>
</Project>

View File

@@ -4,7 +4,7 @@
<RootNamespace>TemplateCmdPalExtension</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<WindowsSdkPackageVersion>10.0.22621.48</WindowsSdkPackageVersion>
<WindowsSdkPackageVersion>10.0.22621.57</WindowsSdkPackageVersion>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>

View File

@@ -100,6 +100,11 @@ public partial class BookmarksCommandProvider : CommandProvider
// debug log error
Debug.WriteLine($"Error loading commands: {ex.Message}");
}
if (_bookmarks == null)
{
_bookmarks = new();
}
}
private CommandItem BookmarkToCommandItem(BookmarkData bookmark)

View File

@@ -273,8 +273,11 @@ public sealed partial class MainWindow : Window,
PInvoke.ShowWindow(_hwnd, SHOW_WINDOW_CMD.SW_HIDE);
}
public void Receive(QuitMessage message) =>
Close();
public void Receive(QuitMessage message)
{
// This might come in on a background thread
DispatcherQueue.TryEnqueue(() => Close());
}
public void Receive(DismissMessage message) =>
PInvoke.ShowWindow(_hwnd, SHOW_WINDOW_CMD.SW_HIDE);

View File

@@ -244,4 +244,24 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
<data name="DefaultSearchPlaceholderText" xml:space="preserve">
<value>Type here to search...</value>
</data>
<data name="Run_PositionHeader.Header" xml:space="preserve">
<value>Preferred monitor position</value>
<comment>as in Show Command Palette on primary monitor</comment>
</data>
<data name="Run_PositionHeader.Description" xml:space="preserve">
<value>If multiple monitors are in use, Command Palette can be launched on the desired monitor</value>
<comment>as in Show Command Palette on primary monitor</comment>
</data>
<data name="Run_Radio_Position_Cursor.Content" xml:space="preserve">
<value>Monitor with mouse cursor</value>
</data>
<data name="Run_Radio_Position_Focus.Content" xml:space="preserve">
<value>Monitor with focused window</value>
</data>
<data name="Run_Radio_Position_Primary_Monitor.Content" xml:space="preserve">
<value>Primary monitor</value>
</data>
<data name="Run_Radio_Position_In_Place.Content" xml:space="preserve">
<value>Don't move</value>
</data>
</root>

View File

@@ -97,8 +97,11 @@ public sealed partial class ToastWindow : Window,
});
}
public void Receive(QuitMessage message) =>
Close();
public void Receive(QuitMessage message)
{
// This might come in on a background thread
DispatcherQueue.TryEnqueue(() => Close());
}
////// Literally everything below here is for acrylic //////

View File

@@ -1,13 +1,46 @@
# Windows Command Palette
# ![cmdpal logo](./Microsoft.CmdPal.UI/Assets/Stable/StoreLogo.scale-100.png) Command Palette
The next version of PT Run.
Windows Command Palette ("CmdPal") is the next iteration of PowerToys Run. With extensibility at it's core, the Command Palette is your one-stop launcher to start _anything_.
## Building
By default, CmdPal is bound to <kbd>Win+Alt+Space</kbd>.
First things first: make sure you've opened up the root PowerToys.sln, and restored its NuGet packages. You will get nuget errors if you don't.
Then, to build the Windows Command Palette, you can open up `WindowsCommandPalette.sln`. Projects of interest are:
* `Microsoft.CmdPal.UI.Poc`: This is the main project for the Windows Command Palette. Build and run this to get the command palette..
* `Microsoft.CommandPalette.Extensions`: This is the official extension interface.
## Creating an extension
The fastest way to get started is just to run the "Create extension" command in the palette itself. That'll prompt you for a project name and a Display Name, and where you want to place your project. Then just open the `sln` it produces. You should be ready to go 🙂.
The official API documentation can be found [on this docs site](TODO! Add docs link when we have one)
We've also got samples, so that you can see how the APIs in-action.
* We've got [generic samples] in the repo
* We've got [real samples] in the repo too
* And we've even got [real extensions that we've "shipped" already]
> [!info]
> The Command Palette is currently in preview. Many features of the API are not yet fully implemented. We may introduce breaking API changes before CmdPal itself is v1.0.0
## Building CmdPal
The Command Palette is included as a part of PowerToys. To get started building, open up the root `PowerToys.sln`, to get started building.
Projects of interest are:
* `Microsoft.CmdPal.UI`: This is the main project for CmdPal. Build and run this to get the CmdPal.
* `Microsoft.CommandPalette.Extensions`: This is the official extension interface.
* This is designed to be language-agnostic. Any programming language which supports implementing WinRT interfaces should be able to implement the WinRT interface.
* `Microsoft.CommandPalette.Extensions.Toolkit`: This is a C# helper library for creating extensions. This makes writing extensions easier.
* Everything under "SampleExtensions": These are example plugins to demo how to author extensions. Deploy any number of these.
* Everything under "SampleExtensions": These are example plugins to demo how to author extensions. Deploy any number of these, to get a feel for how the extension API works.
### Footnotes and other links
* [Initial SDK Spec]
[^1]: you'll almost definitely want to do a `git init` in that directory, and set up a git repo to track your work.
[Initial SDK Spec]: ./doc/initial-sdk-spec/initial-sdk-spec.md
[generic samples]: ./Exts/SamplePagesExtension
[real samples]: .Exts/ProcessMonitorExtension
[real extensions that we've "shipped" already]: https://github.com/zadjii/CmdPalExtensions/blob/main/src/extensions

View File

@@ -1,3 +1,18 @@
# Command Palette Extension Toolkit
We'll write better docs when we're closer to releasing
The C# toolkit for building your own extension for the Command Palette.
The quickest way to get started building an extension is to install the Command
Palette, and use the "Create a new extension" command. That will set up a
project for you, with the packaging, dependencies, and basic program structure
ready to go.
To view the full docs, you can head over to [our docs site](TODO! docs link here when we have it)
You can also add extensions to your existing packages. For detailed docs on how,
refer to [this docs page](TODO! add docs link)
There are samples of just about everything you can do in [the samples project].
Head over there to see basic usage of the APIs.
[the samples project]: https://github.com/microsoft/PowerToys/tree/main/src/modules/cmdpal/Exts/SamplePagesExtension

View File

@@ -16,7 +16,7 @@
<readme>docs\README.md</readme>
<dependencies>
<group targetFramework="net8.0-windows10.0.19041.0">
<dependency id="Microsoft.Windows.CsWinRT" version="2.1.1" />
<dependency id="Microsoft.Windows.CsWinRT" version="2.2.0" />
</group>
</dependencies>
</metadata>