-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Documentation walking through important steps for writing a New PowerToy #44242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| @@ -0,0 +1,258 @@ | |||
| # 🧭 Creating a New PowerToy: End-to-End Developer Guide | |||
|
|
|||
| First of all, thank you for wanting to contribute to PowerToys. The work we do would not be possible with out the support of community supporters like you. | |||
Check failure
Code scanning / check-spelling
Forbidden Pattern Error documentation
|
|
||
| ### Writing your Module Interface | ||
| Begin by setting up the [PowerToy module template project](https://github.com/microsoft/PowerToys/tree/main/tools/project_template). This will generate boilerplate for you to begin your new module. Below I will go through the key headers in the Module Interface (dllmain.cpp) and explain their purpose: | ||
| 1. This is where will will define all of our module settings. These can be any time from strings, bools, ints, and even custom Enums. |
Check failure
Code scanning / check-spelling
Forbidden Pattern Error documentation
| // Can include the enabled variable, logic for event handlers, or hotkeys. | ||
| public: | ||
| // the public members of the class | ||
| // Will include the constructor and intialization logic. |
Check failure
Code scanning / check-spelling
Unrecognized Spelling Error documentation
| } | ||
| ``` | ||
|
|
||
| 4. `init_settings()` initializes the settings for the interface. Will either pull from exisiting settings.json or use defaults. |
Check failure
Code scanning / check-spelling
Unrecognized Spelling Error documentation
|
|
||
| 9. Hotkey functions control the status of the hotkey. | ||
| ```c++ | ||
| // takes the hotkey from settings into a format the interface can understand |
Check failure
Code scanning / check-spelling
Forbidden Pattern Error documentation
|
|
||
| --- | ||
|
|
||
| ### Gotchas: |
Check failure
Code scanning / check-spelling
Unrecognized Spelling Error documentation
| 4. To set breakpoints in your service, press `Ctrl + Alt + P` and search for your service to attach to the runner. | ||
| 5. Use logs to document changes. The logs live at `%LOCALAPPDATA%\Microsoft\PowerToys\RunnerLogs` and `%LOCALAPPDATA%\Microsoft\PowerToys\Module\Service\<version>` for the specific module. | ||
|
|
||
| > **Gotcha:** PowerToys caches `.nuget` artifacts aggressively. Use `git clean -xfd` when builds behave unexpectedly. |
Check failure
Code scanning / check-spelling
Unrecognized Spelling Error documentation
| ### Add Your Module to Installer | ||
|
|
||
| 1. Install [`WixToolset.Heat`](https://www.nuget.org/packages/WixToolset.Heat/) for Wix5 via nuget | ||
| 2. Inside `installer\PowerrToysInstallerVNext` add a new file for your module: `Module.wxs` |
Check failure
Code scanning / check-spelling
Unrecognized Spelling Error documentation
| ```bash | ||
| # Module Name | ||
| Generate-FileList -fileDepsJson "" -fileListName <Module>Files -wxsFilePath $PSScriptRoot\<Module>.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\<ModuleServiceName>" | ||
| Generate-FileComponents -fileListName "<Module>Files" -wxsFilePath $PSScriptRoot\<Module>.wxs -regroot $registryroot |
Check failure
Code scanning / check-spelling
Unrecognized Spelling Error documentation
| ```bash | ||
| # Module Name | ||
| Generate-FileList -fileDepsJson "" -fileListName <Module>Files -wxsFilePath $PSScriptRoot\<Module>.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\<ModuleServiceName>" | ||
| Generate-FileComponents -fileListName "<Module>Files" -wxsFilePath $PSScriptRoot\<Module>.wxs -regroot $registryroot |
Check failure
Code scanning / check-spelling
Unrecognized Spelling Error documentation
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.Unrecognized words (6)exisiting These words are not needed and should be removedCLITo CVS Notavailable toolgood UninitializesTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands... in a clone of the git@github.com:Jaylyn-Barbee/PowerToys.git repository curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/20171785434/attempts/1' &&
git commit -m 'Update check-spelling metadata'Forbidden patterns 🙅 (3)In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves. These forbidden patterns matched content: Articles generally shouldn't be used without a noun and a verb
Should be
|
| ❌ Errors | Count |
|---|---|
| ❌ forbidden-pattern | 3 |
See ❌ Event descriptions for more information.
If the flagged items are 🤯 false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it,
try adding it to thepatterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
| 3. To simulate a "new user" you can delete the PowerToys folder from `%LOCALAPPDATA%\Microsoft` | ||
| --- | ||
| ## 9. Out-of-Box Experience (OOBE) page | ||
| The OOBE page is a custom settings page that gives the user at a glance information about each module. This Window opens first before the Settings application for new users and after updates. Create `OOBE<ModuleName>.xaml` at ` src\settings-ui\Settings.UI\SettingsXAML\OOBE\Views`. You will also need to add your module name to the enum at `src\settings-ui\Settings.UI\OOBE\Enums\PowerToysModules.cs` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The body text is rendering in H2
| --- | ||
| ## 9. Out-of-Box Experience (OOBE) page | ||
| The OOBE page is a custom settings page that gives the user at a glance information about each module. This Window opens first before the Settings application for new users and after updates. Create `OOBE<ModuleName>.xaml` at ` src\settings-ui\Settings.UI\SettingsXAML\OOBE\Views`. You will also need to add your module name to the enum at `src\settings-ui\Settings.UI\OOBE\Enums\PowerToysModules.cs` | ||
| -- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things that come to mind that are missing (in Step 10):
- Module Icon
- Module Image
- OOBE Image
- Docs
I'd maybe call these out as something to consider but we can handle those for the sake of consistency.
| ### Requirements | ||
|
|
||
| * [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (Desktop & C++ workloads) | ||
| * .NET 8 SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 or 9? I dunno, was just wondering :).
Also, does this need to be installed manually? Wouldn't just setting up VS the right way have everything you'd need?
|
|
||
| * [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (Desktop & C++ workloads) | ||
| * .NET 8 SDK | ||
| * [WiX v5 toolset](https://github.com/microsoft/PowerToys/tree/main) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For creating a new module you wouldn't need this do you?
| * .NET 8 SDK | ||
| * [WiX v5 toolset](https://github.com/microsoft/PowerToys/tree/main) | ||
| * [PowerToys repository](https://github.com/microsoft/PowerToys/tree/main) cloned locally | ||
| * [Able to build and run](https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/development/debugging.md) `PowerToys.slnx`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * [Able to build and run](https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/development/debugging.md) `PowerToys.slnx`. | |
| * [Validate that you are able to build and run](https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/development/debugging.md) `PowerToys.slnx`. |
| * [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (Desktop & C++ workloads) | ||
| * .NET 8 SDK | ||
| * [WiX v5 toolset](https://github.com/microsoft/PowerToys/tree/main) | ||
| * [PowerToys repository](https://github.com/microsoft/PowerToys/tree/main) cloned locally |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * [PowerToys repository](https://github.com/microsoft/PowerToys/tree/main) cloned locally | |
| * Clone the [PowerToys repository](https://github.com/microsoft/PowerToys/tree/main) locally |
|
|
||
| First of all, thank you for wanting to contribute to PowerToys. The work we do would not be possible with out the support of community supporters like you. | ||
|
|
||
| This guide documents the process of building a new PowerToys utility from scratch, including architecture decisions, integration steps, and common pitfalls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we reference this somewhere, like https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/readme.md#how-to-create-new-powertoys?
|
|
||
| ### Requirements | ||
|
|
||
| * [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (Desktop & C++ workloads) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be exact on what to install / configure.
We also have this Winget config file (I do not know if this is up to date):
PowerToys/.config/configuration.winget
Line 13 in e13d6a7
| - resource: Microsoft.WinGet.DSC/WinGetPackage |
Maybe something like
"Make sure you have the right dev environment set up:
- Visual Studio
- List of components to check in VS
or use this Winget config file:
winget config linktofile blabla
Summary of the Pull Request
This new document serves as a handy guide, packed with key details and helpful tips to keep in mind when creating a new PowerToy.