PowerToys/doc/devdocs/core/architecture.md
Gleb Khmyznikov 725535b760
Some checks failed
Spell checking / Check Spelling (push) Has been cancelled
Spell checking / Report (Push) (push) Has been cancelled
Spell checking / Report (PR) (push) Has been cancelled
Spell checking / Update PR (push) Has been cancelled
[DevDocs] More content and restructure (#40165)
## Summary of the Pull Request
Accumulated information from internal transition about the modules
development, and reworked it to be added in dev docs. Also the dev docs
intself was restructured to be more organized. New pages was
verified by transition team.

## PR Checklist
- [x] **Dev docs:** Added/updated

---------

Co-authored-by: Zhaopeng Wang (from Dev Box) <zhaopengwang@microsoft.com>
Co-authored-by: Hao Liu <liuhao3418@gmail.com>
Co-authored-by: Peiyao Zhao <105847726+zhaopy536@users.noreply.github.com>
Co-authored-by: Mengyuan <162882040+chenmy77@users.noreply.github.com>
Co-authored-by: zhaopeng wang <33367956+wang563681252@users.noreply.github.com>
Co-authored-by: Jaylyn Barbee <51131738+Jaylyn-Barbee@users.noreply.github.com>
2025-07-01 14:27:34 +02:00

79 lines
2.8 KiB
Markdown

# PowerToys Architecture
## Module Interface Overview
Each PowerToys utility is defined by a module interface (DLL) that provides a standardized way for the PowerToys Runner to interact with it. The module interface defines:
- Structure for hotkeys
- Name and key for the utility
- Configuration management
- Enable/disable functionality
- Telemetry settings
- Group Policy Object (GPO) configuration
### Types of Modules
1. **Simple Modules** (like Mouse Pointer Crosshairs, Find My Mouse)
- Entirely contained in the module interface
- No external application
- Example: Mouse Pointer Crosshairs implements the module interface directly
2. **External Application Launchers** (like Color Picker)
- Start a separate application (e.g., WPF application in C#)
- Handle events when hotkeys are pressed
- Communication via named pipes or other IPC mechanisms
3. **Context Handler Modules** (like Power Rename)
- Shell extensions for File Explorer
- Add right-click context menu entries
- Windows 11 context menu integration through MSIX
4. **Registry-based Modules** (like Power Preview)
- Register preview handlers and thumbnail providers
- Modify registry keys during enable/disable operations
## Common Dependencies and Libraries
- SPD logs for C++ (centralized logging system)
- CPP Win RT (used by most utilities)
- Common utilities in `common` folder for reuse across modules
- Interop library for C++/C# communication (converted to C++ Win RT)
- Common.UI library has WPF and WinForms dependencies
## Resource Management
- For C++ applications and module interfaces:
- Resource files (.resx) need to be converted to .rc
- Use conversion tools before building
- Different resource approaches:
- WPF applications use .resx files
- WinUI 3 apps use .resw files
- PRI file naming requirements:
- Need to override default names to avoid conflicts during flattening
## Implementation details
### [`Runner`](runner.md)
The PowerToys Runner contains the project for the PowerToys.exe executable.
It's responsible for:
- Loading the individual PowerToys modules.
- Passing registered events to the PowerToys.
- Showing a system tray icon to manage the PowerToys.
- Bridging between the PowerToys modules and the Settings editor.
### [`Interface`](../modules/interface.md)
The definition of the interface used by the [`runner`](/src/runner) to manage the PowerToys. All PowerToys must implement this interface.
### [`Common`](../common.md)
The common lib, as the name suggests, contains code shared by multiple PowerToys components and modules, e.g. [json parsing](/src/common/utils/json.h) and [IPC primitives](/src/common/interop/two_way_pipe_message_ipc.h).
### [`Settings`](settings/readme.md)
Settings v2 is our current settings implementation. Please head over to the dev docs that describe the current settings system.