Skip to content

Add Display Profiles for saved monitor topologies - #51103

Draft
Francesco Vecchio (Rhaegal222) wants to merge 30 commits into
microsoft:mainfrom
Rhaegal222:feature/monitorpower-command-palette
Draft

Francesco Vecchio (Rhaegal222) wants to merge 30 commits into
microsoft:mainfrom
Rhaegal222:feature/monitorpower-command-palette

Conversation

@Rhaegal222

Copy link
Copy Markdown

Summary

  • add a shared MonitorPower.Core implementation for Windows display topology discovery, profile persistence, validation, recovery, and application
  • add the Display Profiles Settings page and runtime selector with keyboard and Xbox controller activation
  • add a standalone Command Palette extension that consumes the same core and profile store
  • add dedicated Display Profiles assets, localization resources, accessibility feedback, and unit coverage

Architecture

Settings is the primary built-in experience. PowerToys.MonitorPower.Runtime owns global activation and the quick selector. The standalone Command Palette extension is a complementary surface and does not register another global keyboard or controller listener.

Both surfaces share profiles from %LOCALAPPDATA%\MonitorPower\profiles and reuse MonitorPower.Core; display topology and persistence logic are not duplicated.

Validation

  • tools\build\build.cmd -Platform x64 -Configuration Debug — passed, 0 errors
  • vstest.console.exe ...Settings.UI.UnitTests.dll /Tests:CommonLibTest.MonitorPowerTests /Platform:x64 — 10/10 passed
  • standalone extension Debug x64 build — passed
  • extension loaded by published Command Palette — passed
  • extension loaded by Dev Command Palette — passed
  • git diff --check — passed

Notes for review

  • This draft intentionally includes both surfaces so maintainers can evaluate the product boundary and shared architecture together.
  • The standalone extension's production distribution/signing strategy still needs maintainer guidance.
  • Localization source strings are included; translated resources remain handled by the PowerToys localization pipeline.
  • Multi-monitor manual safety testing should be expanded before merge.

Related to #48286.

- Implemented KeyboardHook class to handle keyboard events for Escape and Xbox buttons.
- Created MonitorPowerCommandsProvider to manage command items for the Monitor Power extension.
- Added CreateProfilePage and MonitorPowerListPage for user interaction with display profiles.
- Introduced resource files for localization and UI text management.
- Established project structure and dependencies in the MonitorPowerExtension.csproj file.
…ndency

- Replace keyboard hook with XInput polling (Guide button generates no WM_KEYDOWN)
- Guide+View combo fires CycleSavedProfiles() instead of old CycleTopology
- Use ApplySavedProfileReference → ActivateDisplays → CDSE fallback
  (SetDisplayConfig returns error 87 on this build)
- Remove XboxTripleTapped stub (MissingMethodException on old binary)
- Remove Microsoft.Terminal.UI C++ dependency from CmdPal.UI.csproj
- C# reimplementations: IconPathConverter.IconSourceMUX() in IconPathConverter.cs
- C# reimplementation: RunHistory.CreateRunHistory() inlined in RunHistoryService.cs
- Fix StyleCop SA1512/SA1025 and CA2101 warnings
- Add unit tests for display profile helpers and CDSE activation
…Converter/RunHistory C# ports, XboxTripleTapped removed
- Introduced the Monitor Power Extension project with support for managing monitor profiles.
- Added new error message resource for no active monitors remaining.
- Created a PowerShell script to extend all monitors using DisplaySwitch.exe and SetDisplayConfig.
- Updated App.xaml.cs to include MonitorPowerCommandsProvider in the service configuration.
- Added README.md to document profile storage locations and usage instructions.
- Introduced Create-Profiles2.ps1 for generating monitor profiles based on target IDs and layout configurations from display-layout.json.
- Implemented MonitorPower-Tool.ps1 for unified monitor management, including commands to extend displays, save and restore layouts, and test display configurations.
- Added display-layout.json as a reference layout for monitor configurations, detailing properties such as resolution, frequency, and orientation for multiple displays.
…ling

- Enhanced DisplayProfilesPage.xaml.cs to support capturing keyboard shortcuts and improved error handling during initialization.
- Added functionality for managing display profiles, including saving, overwriting, renaming, and duplicating profiles with user confirmation dialogs.
- Introduced new ViewModel properties to track loading states and diagnostics.
- Created ControllerChord and KeyboardActivationShortcut classes for better handling of controller inputs and keyboard shortcuts.
- Implemented MonitorPowerProfile and persistence logic for saving and loading profiles in JSON format.
- Added unit tests for profile persistence, topology mapping, controller chord parsing, and keyboard shortcut validation.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nality

- Removed unused PreviewKeyDown event handler and related logic for capturing activation shortcuts.
- Enhanced the DisplayProfilesPage.xaml layout by adding a built-in badge for profiles and adjusting button visibility based on profile type.
- Updated the controller shortcut functionality to capture and display the correct chord for Xbox controllers, changing the default from "Guide + View" to "View + A".
- Simplified the diagnostics log opening process and removed unnecessary diagnostics refresh logic.
- Introduced built-in profile handling to prevent overwriting reserved names and improved user feedback for profile actions.
- Updated resource strings to reflect changes in controller shortcut instructions and diagnostics log actions.
- Implemented display mode selection logic in DisplayProfilesPage.xaml.cs, allowing users to switch between extending displays and using the primary display only.
- Added functionality to identify active displays with an overlay showing their index for 3 seconds.
- Improved profile management by introducing validation for profile names and ensuring at least one display is selected before saving a profile.
- Refactored profile application logic to maintain the selected profile state and improve user feedback during operations.
- Created a new Section control for better UI organization, encapsulating title, subtitle, and content areas.
- Updated localization strings for better clarity and accessibility in the display profiles section.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the Product-Command Palette Refers to the Command Palette utility label Oct 8, 2026
@Rhaegal222

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@Rhaegal222

Copy link
Copy Markdown
Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 51103 in repo microsoft/PowerToys

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Command Palette Refers to the Command Palette utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants