PowerToys Run Plugins
PowerToys Run is a quick launcher that allows users to search for applications, files, and perform various actions. The plugin system enables developers to extend PowerToys Run with custom functionality.Plugin Architecture
PowerToys Run plugins are C# class libraries that implement theIPlugin interface from the Wox.Plugin namespace. Each plugin is loaded dynamically by PowerToys Run and can respond to user queries.
Core Interfaces
IPlugin Interface
Every plugin must implement theIPlugin interface:
src/modules/launcher/Wox.Plugin/IPlugin.cs
Optional Interfaces
Plugins can implement additional interfaces for extended functionality:IPluginI18n- Localization supportIContextMenu- Right-click context menuISettingProvider- Settings UIIDelayedExecutionPlugin- Async query processingIResultUpdated- Dynamic result updates
Creating Your First Plugin
Step 1: Create the Project
Create a new C# class library project:- Microsoft plugins:
Microsoft.PowerToys.Run.Plugin.{PluginName} - Community plugins:
Community.PowerToys.Run.Plugin.{PluginName}
Step 2: Implement the Plugin
Create aMain.cs file:
Step 3: Create plugin.json
Create aplugin.json file in your project root:
| Field | Description |
|---|---|
ID | Unique GUID for the plugin |
ActionKeyword | Keyword to activate plugin directly (e.g., ex <query>) |
IsGlobal | If true, plugin responds to all queries |
Name | Plugin name (must be unique) |
Author | Plugin author |
Version | Plugin version |
Language | Programming language (currently only csharp) |
Website | Plugin website or repository |
ExecuteFileName | DLL filename |
IcoPathDark | Dark theme icon path (relative to plugin folder) |
IcoPathLight | Light theme icon path (relative to plugin folder) |
DynamicLoading | (Optional) Whether to load dependencies in isolation |
Make sure the
ID in plugin.json matches the PluginID property in your Main class.Plugin API Reference
Query Object
TheQuery object contains information about the user’s search:
src/modules/launcher/Wox.Plugin/Query.cs
Result Object
TheResult object represents a single result item:
src/modules/launcher/Wox.Plugin/Result.cs
PluginInitContext
Provided during plugin initialization:src/modules/launcher/Wox.Plugin/PluginInitContext.cs
IPublicAPI Interface
Provides access to PowerToys Run functionality:src/modules/launcher/Wox.Plugin/IPublicAPI.cs
Real-World Example: Unit Converter Plugin
Here’s a simplified version of the actual Unit Converter plugin from PowerToys:src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/Main.cs
- Custom query parsing with
InputInterpreter - Business logic in separate
UnitHandlerclass - Context menu with copy action
- Theme-aware icons
- Proper disposal pattern
Adding Context Menus
ImplementIContextMenu to add right-click actions:
Testing Your Plugin
Local Testing
-
Build your plugin:
-
Copy plugin files to PowerToys plugins folder:
-
Required files:
{YourPluginName}.dllplugin.json- Icon files (light and dark)
- Any dependencies
-
Restart PowerToys Run:
- Open PowerToys settings
- Go to PowerToys Run
- Toggle it off and on
Unit Testing
Create unit tests using MSTest:Plugin Checklist
Before submitting your plugin, ensure:- Project follows naming pattern:
{Type}.PowerToys.Run.Plugin.{PluginName} - Target framework is
net9.0-windows10.0.22621.0 -
plugin.jsonfile is present and valid - Plugin ID in code matches
plugin.json - Both light and dark theme icons are included
- Unit tests are written using MSTest
- Plugin handles empty/invalid queries gracefully
- Action returns
true(close) orfalse(keep open) appropriately - Theme change events are handled
- Resources are properly disposed (implement
IDisposableif needed)
Distribution
Contributing to PowerToys
To include your plugin in PowerToys:- Add plugin to installer (
installer/PowerToysSetup/Product.wxs) - Add to signed build pipeline (
.pipelines/pipeline.user.windows.yml) - Create unit tests
- Follow localization process
- Submit pull request
Independent Distribution
You can distribute plugins independently:- Build your plugin
- Package DLL,
plugin.json, and icons - Provide installation instructions for users
- Users copy files to:
%LOCALAPPDATA%\Microsoft\PowerToys\PowerToys Run\Plugins\{YourPluginName}\