Commit Graph

8489 Commits

Author SHA1 Message Date
Niels Laute
9c23cbd448 More changes to the Settings page 2025-11-24 20:22:36 +01:00
Niels Laute
2992907142 More changes 2025-11-24 16:28:51 +01:00
Niels Laute
a7e006332a Fixes 2025-11-24 15:12:10 +01:00
Niels Laute
d85d109c78 Bunch of UX improvements to the flyout 2025-11-24 14:51:32 +01:00
Niels Laute
fe5edd9c5d First set of UX changes to flyout 2025-11-24 12:23:59 +01:00
Yu Leng
8806e4ef2e Remove deprecated Power Display event methods
Removed `ShowPowerDisplayEvent`, `TerminatePowerDisplayEvent`,
`SettingsUpdatedPowerDisplayEvent`, and
`ApplyColorTemperaturePowerDisplayEvent` methods from the
`Constants` class in `Constants.cpp`, `Constants.h`, and
`Constants.idl`. These methods were associated with Power
Display functionality that is no longer needed.

This change simplifies the codebase by removing unused
constants and methods related to Power Display events.
2025-11-21 17:08:50 +08:00
Yu Leng
b4ccac5ec2 Update InfoBar and resource strings for PowerDisplay
Updated the `InfoBar` in `LightSwitchPage.xaml` to improve
accessibility and visual consistency, including changes to
`Severity`, `Background`, and `HyperlinkButton` alignment.

Added new resource entries in `Resources.resw` for monitor
settings and updated the `PowerDisplayDisabledWarningBar`
title to clarify its purpose. Introduced additional resource
strings to support the updated messaging.
2025-11-21 16:45:15 +08:00
Yu Leng
b381472bf7 Refactor LightSwitch and PowerDisplay integration
Simplify theme change notification logic in `LightSwitchService.cpp` by consolidating redundant checks and improving error handling. Remove the `applyMonitorSettings` setting and associated logic from `LightSwitchSettings`.

Introduce `PowerDisplayProfilesHelper` to centralize profile management, ensuring thread safety and simplifying file operations. Update UI in `LightSwitchPage.xaml` to replace `ApplyMonitorSettings` with separate dark and light mode profile settings, adding navigation to PowerDisplay settings.

Enhance `LightSwitchViewModel` with nullable annotations, new profile selection properties, and improved property synchronization. Refactor `PowerDisplayViewModel` to use `PowerDisplayProfilesHelper` for profile management.

Update localization strings for new UI elements. Perform general code cleanup, including null safety annotations, improved logging, and removal of legacy code.
2025-11-21 15:36:56 +08:00
Yu Leng
925c97a7f9 Add PowerDisplay integration for theme-based profiles
Integrated PowerDisplay with LightSwitch to enable automatic monitor profile switching based on theme changes. Added event signaling to notify PowerDisplay of theme updates.

Enhanced `LightSwitchService` to support this integration and improved logging for better traceability. Updated `LightSwitchSettings` and `LightSwitchConfig` to include new settings for monitor profile management.

Introduced a background thread in `MainViewModel` to listen for theme change events and apply the appropriate PowerDisplay profile. Added UI elements for managing monitor settings and profiles in `LightSwitchPage`.

Implemented methods in `LightSwitchViewModel` to load PowerDisplay profiles, check module status, and manage new settings. Added localized strings for the new UI elements and warnings.

Improved backward compatibility for old profiles and enhanced error handling throughout the codebase.
2025-11-20 17:30:10 +08:00
Yu Leng
336234d05b Add InternalName for monitor identification
Enhanced monitor identification by introducing the `InternalName`
property as a unique identifier, with fallback to `HardwareId`
for backward compatibility. Updated `MainViewModel` logic,
logging, and UI bindings to use `InternalName`.

Extended `ProfileMonitorSetting` to include `MonitorInternalName`
for serialization and profile management. Adjusted profile
creation and pre-fill logic to support the new property.

These changes improve robustness, maintain compatibility with
older profiles, and enhance clarity in logging and the UI.
2025-11-20 16:36:37 +08:00
Yu Leng
8aec939c9d Enhance profile settings and UI for monitor controls
Refactor logic to support optional inclusion of brightness, contrast, volume, and color temperature in monitor profiles. Updated `Brightness` and `ColorTemperature` to nullable types and adjusted related logic in `MainViewModel.cs` and `ProfileMonitorSetting.cs`.

Improved the UI in `PowerDisplayPage.xaml` and `ProfileEditorDialog.xaml`:
- Added toggle switches for selectively including settings in profiles.
- Enhanced layout and styling for better user experience.
- Updated context menu and monitor selection visuals.

Enhanced `MonitorSelectionItem.cs` with new `Include` flags and auto-selection suppression. Updated `ProfileEditorViewModel.cs` to validate profiles and ensure at least one setting is included for selected monitors.

Performed general code cleanup for readability and maintainability.
2025-11-20 15:13:27 +08:00
Yu Leng
d64bb78727 Refactor PowerDisplay profile management
Simplified profile management by removing the concept of "Custom profiles" and "current profile" tracking. Profiles are now treated as templates for quick application of monitor settings, rather than persistent states.

Key changes include:
- Replaced `ObservableCollection<string>` with `ObservableCollection<PowerDisplayProfile>` to manage profile objects directly.
- Removed redundant properties and methods related to "selected" and "current" profiles.
- Refactored methods for creating, updating, and deleting profiles to operate on `PowerDisplayProfile` objects.
- Updated `PowerDisplayViewModel` and `ProfileManager` to streamline profile loading, saving, and application logic.
- Updated the UI to replace the profile dropdown with buttons for quick application, along with context menu options for managing profiles.
- Improved logging and error handling for profile operations.
- Updated resource strings and removed references to "Custom profiles" and "current profile."

These changes simplify the codebase, improve maintainability, and align the application with the new design philosophy of treating profiles as templates.
2025-11-20 04:40:36 +08:00
Yu Leng
b8abff02ac Add profile management system to PowerDisplay
Introduced a comprehensive profile management system for PowerDisplay, enabling users to create, edit, delete, and apply predefined monitor settings. Key changes include:

- Added `ProfileManager` for handling profile storage and retrieval.
- Introduced `PowerDisplayProfile`, `PowerDisplayProfiles`, and related data models for profile representation.
- Enhanced `MainViewModel` and `MonitorViewModel` to support profile application and parameter change detection.
- Created `ProfileEditorDialog` for editing and creating profiles via the UI.
- Updated `PowerDisplayViewModel` to manage profiles, including commands for adding, deleting, renaming, and saving profiles.
- Added new events (`ApplyProfileEvent`) and constants for profile application.
- Updated `PowerDisplayPage` UI to include a "Profiles" section for managing profiles.
- Added serialization support for profile-related classes.
- Updated `dllmain.cpp` and `App.xaml.cs` to handle profile-related events.

These changes improve user experience by allowing quick switching between tailored monitor configurations.
2025-11-19 17:18:01 +08:00
Yu Leng
fc54172e13 Refactor color temperature operation handling
Introduced `ColorTemperatureOperation` class to manage pending color temperature changes. Updated `MainViewModel` to process operations for specific monitors, improving efficiency and separation of concerns.

Added `PendingColorTemperatureOperation` property to `PowerDisplayProperties` for tracking operations. Enhanced IPC messaging with `MonitorId` and `ColorTemperature` in `PowerDisplayActionMessage`.

Refactored `PowerDisplayViewModel` and `PowerDisplayPage` to directly apply color temperature to specified monitors. Improved logging for better traceability.
2025-11-19 16:16:04 +08:00
Yu Leng
a48e999963 Improve error handling, debouncing, and code cleanup
Enhanced exception handling in RelayCommand to improve robustness.
Standardized slider debounce delays using a new constant
`SliderDebounceDelayMs`. Improved resource management in
SimpleDebouncer with proper disposal of CancellationTokenSource
and added support for synchronous actions. Refactored event
handling in App.xaml.cs for clarity and consistency. Removed
redundant logging in MonitorStateManager and MainViewModel to
reduce verbosity. Updated namespaces and dependencies for better
organization. General code cleanup to improve readability and
maintainability.
2025-11-19 15:26:35 +08:00
Yu Leng
ad83b5e67f Improve performance, thread safety, and resource handling
Enhanced monitor initialization with parallelism in `MonitorManager.cs` for better performance. Added cancellation support to `NativeEventWaiter.cs` with `CancellationToken` and timeout handling. Introduced thread safety in `PhysicalMonitorHandleManager.cs` using locks to prevent race conditions.

Updated `PowerDisplayViewModel.cs` to include proper resource cleanup with `CancellationTokenSource` and improved memory management. Added necessary namespaces for threading and asynchronous operations. General code improvements for readability, maintainability, and reliability.
2025-11-19 15:08:00 +08:00
Yu Leng
f10c9f49e9 Add color temperature support to PowerDisplay
Enhanced PowerDisplay with support for applying color temperature settings.

- Added `APPLY_COLOR_TEMPERATURE_POWER_DISPLAY_EVENT` and event handling logic.
- Introduced `ApplyColorTemperatureFromSettings` in `MainViewModel` for explicit hardware updates.
- Refactored `MonitorInfo` to dynamically compute and cache color temperature presets.
- Updated `ReloadMonitorsFromSettings` to preserve object references and improve UI responsiveness.
- Simplified UI bindings and removed redundant properties like `MonitorType`.
- Improved event handling in `dllmain.cpp` for the new color temperature action.
- Enhanced logging for better debugging and traceability.
- Updated JSON serialization context to include new types for color temperature.
- Removed unused code and improved documentation for maintainability.
2025-11-18 20:03:36 +08:00
Yu Leng
3f84ccc603 Refactor and modernize codebase for maintainability
Refactored code to improve performance, readability, and scalability:
- Removed color temperature constants and obsolete VCP codes.
- Converted `MonitorStateManager` methods to async for non-blocking I/O.
- Added retry logic for physical monitor discovery in `DdcCiController`.
- Simplified UI logic in `MainWindow.xaml.cs` by removing animations.
- Streamlined `MainViewModel` initialization and reduced excessive logging.
- Enhanced error handling during disposal and initialization processes.
- Removed deprecated methods and unused features for cleaner code.
- Consolidated repetitive code into reusable helper methods.
- Replaced hardcoded UI constants with configurable values in `AppConstants`.

These changes align the application with modern coding practices.
2025-11-18 01:42:10 +08:00
Yu Leng
55cd6c95b8 Fix settings issue 2025-11-17 18:21:46 +08:00
Yu Leng
15e6a762d3 fix settings ui issue 2025-11-17 16:13:52 +08:00
Yu Leng
f05740b0cb Fix color temperature doesn't work issue 2025-11-17 15:39:36 +08:00
Yu Leng
5f97f7f222 Fix UI issue 2025-11-17 14:53:43 +08:00
Yu Leng
94bc13e703 Refactor PowerDisplay for dynamic monitor capabilities
Removed reliance on static `MonitorType` enumeration, replacing it with dynamic `CommunicationMethod` for better flexibility. Updated `IMonitorController` and `MonitorManager` to dynamically determine monitor control capabilities.

Refactored `Monitor` model to streamline properties and improve color temperature handling. Enhanced `MonitorViewModel` with unified methods for brightness, contrast, volume, and color temperature updates, improving UI responsiveness and hardware synchronization.

Improved settings handling by adding support for hidden monitors, preserving user preferences, and separating UI configuration from hardware parameter updates. Updated the PowerDisplay Settings UI with warnings, confirmation dialogs, and better VCP capabilities formatting.

Removed legacy IPC code in favor of event-driven settings updates. Conducted general code cleanup, improving logging, error handling, and documentation for maintainability.
2025-11-14 16:45:22 +08:00
Yu Leng
e645a19629 Refactor color temperature handling to use VCP presets
Transitioned color temperature handling from Kelvin-based values to VCP code `0x14` (Select Color Preset). Removed legacy Kelvin-to-VCP conversion logic and deprecated unused VCP codes. Updated `Monitor` and `MonitorViewModel` to reflect this change, making `ColorTemperature` read-only in the flyout UI and configurable via the Settings UI.

Enhanced monitor capabilities detection by relying on reported VCP codes instead of trial-and-error probing. Introduced `CapabilitiesStatus` to indicate feature availability and dynamically populated color temperature presets from VCP code `0x14`.

Streamlined the UI by replacing the color temperature slider with a ComboBox in the Settings UI. Added tooltips, warnings for unavailable capabilities, and improved logging for brightness and color temperature operations.

Removed obsolete code, simplified feature detection logic, and improved code documentation. Fixed issues with unsupported VCP values and ensured consistent ordering of color presets.
2025-11-14 13:17:55 +08:00
Yu Leng
4c799b61fc Update 2025-11-14 02:51:43 +08:00
Yu Leng
83410f1bc8 Add acknowledgment of Twinkle Tray in NOTICE.md
Acknowledged the use of techniques from the "Twinkle Tray"
project in the "PowerDisplay" utility's DDC/CI implementation.
Included a reference to the Twinkle Tray GitHub repository
and added the full text of its MIT License.
2025-11-13 14:29:40 +08:00
Yu Leng
33d5ff26c6 Refactor logging, state management, and IPC
Improved logging consistency by replacing verbose debug logs with concise warnings and errors where appropriate. Introduced a debounced-save strategy in `MonitorStateManager` to optimize disk I/O during rapid updates. Removed the `PowerDisplayProcessManager` class and named pipe-based IPC, indicating a significant architectural shift.

Translated all comments from Chinese to English for better readability. Simplified and refactored initialization logic in `MainWindow.xaml.cs` for better maintainability. Removed unused code, including system tray-related structures and imports, and improved overall code clarity and consistency.
2025-11-13 14:14:49 +08:00
Yu Leng
d822745c98 Remove tray icon functionality from PowerDisplay
The tray icon functionality has been completely removed from the
PowerDisplay application. This includes:

- Deletion of the `PowerDisplay.ico` file.
- Removal of the `TrayIconHelper.cs` class, which managed the tray
  icon's creation, updates, and interactions.
- Elimination of all references to `TrayIconHelper` in
  `MainWindow.xaml.cs`, including tray icon initialization, event
  handling, and disposal logic.
- Removal of the `<ApplicationIcon>` property in `PowerDisplay.csproj`.

These changes simplify the application by reducing its responsibilities
and dependencies, potentially aligning with a new design direction.
2025-11-13 13:06:37 +08:00
Yu Leng
0b7109dee4 Add toggle event for PowerDisplay window visibility
Introduced `TOGGLE_POWER_DISPLAY_EVENT` to enable toggling the
PowerDisplay window's visibility. Updated `App.xaml.cs` to handle
the new event and added the `ToggleWindow` method in
`MainWindow.xaml.cs` to manage window visibility.

Enhanced `MainWindow` with auto-hide functionality when the
window loses focus. Updated `dllmain.cpp` to integrate the
toggle event, including creating, signaling, and cleaning up
the event handle. Replaced `SHOW_POWER_DISPLAY_EVENT` with
`TOGGLE_POWER_DISPLAY_EVENT` for improved functionality.

Improved logging across the codebase for better traceability
and debugging. Performed general refactoring and ensured proper
resource management for event handles.
2025-11-13 12:56:12 +08:00
Yu Leng
ac9fd27095 Refactor PowerDisplay to use Windows Named Events
Replaced IPC-based communication with Windows Named Events for
simpler and more reliable process interaction. Introduced the
`NativeEventWaiter` helper class to handle event signaling and
callbacks. Removed the `PowerDisplayProcessManager` class and
refactored process lifecycle management to use direct process
launching and event signaling.

Simplified `App.xaml.cs` by removing IPC logic and adding event-
based handling for window visibility, monitor refresh, settings
updates, and termination. Enhanced `MainWindow` initialization
and show logic with detailed logging and error handling.

Updated `dllmain.cpp` to manage persistent event handles and
refactored the `enable` and `disable` methods to use event-based
communication. Improved process termination logic with additional
checks and logging.

Performed general cleanup, including removing unused code,
improving readability, and enhancing error handling throughout
the codebase.
2025-11-13 12:40:56 +08:00
Yu Leng
753fecbe9f Update PowerDisplay hotkey and add module launch support
Updated `JSON_KEY_ACTIVATION_SHORTCUT` to use lowercase for
consistency. Added `isShown` flag to `m_activation_hotkey`
to indicate visibility, setting it in relevant scenarios.

Added support for launching the PowerDisplay module via
an IPC message in `LaunchPage.xaml.cs`. Improved robustness
by adding a `default` case to handle unexpected `ModuleType`
values in the switch statement.
2025-11-12 23:18:14 +08:00
Yu Leng
c24b5d97c5 Use UTF-16 for pipe communication and simplify signaling
Refactored `send_message_to_powerdisplay` to use UTF-16
encoding for pipe communication, aligning with WinUI's
`Encoding.Unicode`. Removed UTF-8 conversion logic and
streamlined payload handling with `CString`.

Simplified the signaling mechanism in `dllmain.cpp` for
notifying `PowerDisplay.exe` of settings updates. The
message now excludes `config` data, relying on
`PowerDisplay.exe` to read the updated `settings.json`
file directly. Updated comments to reflect the new
behavior.
2025-11-12 17:08:30 +08:00
Yu Leng
5d63ca7a9c Refactor IPC and enhance PowerDisplay functionality
Refactored IPC communication by introducing a `NamedPipeProcessor` utility for unidirectional named pipe handling, replacing the old bidirectional implementation. Simplified application lifecycle management by removing mutex usage and relying on `AppInstance` for single-instance enforcement.

Replaced IPC-based monitor updates with file-based updates, saving monitor data to `settings.json` for the Settings UI. Added an `ActivationShortcut` property to PowerDisplay settings and updated the settings page UI to support shortcut configuration.

Simplified named pipe creation in `PowerDisplayProcessManager` by removing bidirectional pipe logic and focusing on unidirectional communication. Improved `MainWindow` initialization with an `EnsureInitializedAsync` method.

Updated localization resources and integrated PowerDisplay into the launcher menu. Removed redundant code, improved logging, and streamlined resource cleanup for better maintainability.
2025-11-12 16:36:43 +08:00
Yu Leng
e90c4273f7 Refactor PowerDisplay IPC and add hotkey support
Refactored IPC initialization to handle window visibility based on
launch mode (standalone or IPC). Added `IsWindowVisible` P/Invoke
method and implemented IPC commands for window control, monitor
refresh, and settings updates.

Fixed bidirectional pipe creation and adjusted process startup
order in `PowerDisplayProcessManager`. Made `ShowWindow` and
`HideWindow` methods public and added `IsWindowVisible` to
`MainWindow.xaml.cs`.

Introduced activation hotkey parsing and configuration with a
default of `Win+Alt+M`. Exposed hotkey to PowerToys runner and
integrated it into the dashboard with localization and a launch
button. Renamed module DLL for consistency.
2025-11-12 13:18:36 +08:00
Yu Leng
e2774eff2d Introduce PowerDisplay 2025-10-20 16:22:47 +08:00
leileizhang
b1985bc8d1 Introduce shared sparse package identity for PowerToys (#42352)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This pull request adds support for building, installing, and managing a
shared sparse MSIX package to grant package identity to select Win32
components in PowerToys. It introduces a new `PackageIdentity` project,
updates the installer to handle the new MSIX package during
install/uninstall, and provides developer documentation for working with
the sparse package. Additionally, new dependencies and signing rules are
included to support these changes.

**Sparse Package Identity Support**

* Added new `PackageIdentity` project to the solution for building the
sparse MSIX package, and included it in solution/project build
configurations (`PowerToys.sln`).
[[1]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R29)
[[2]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R54-R55)
[[3]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R873-R880)
* Added developer documentation (`sparse-package.md`) and updated
documentation indexes to describe how to build, register, and consume
the sparse MSIX package.
[[1]](diffhunk://#diff-b4e39fb55a49c6de336d5847d75a55dd1d14840578da0ed9130f0130b61b34aaR1-R87)
[[2]](diffhunk://#diff-d0f204e503506a26ef2aa3605a8d64ac353393526fb5dcf48d4287c821f3edbcR31)
[[3]](diffhunk://#diff-430296c8d28f70d8a0164b44d7dfc30ffb1fb32466dad181947f35885b7f28d1R13)

**Installer Enhancements**

* Implemented new custom actions in the installer to install and
uninstall the `PowerToysSparse.msix` package, supporting both per-user
and machine-level scenarios (`CustomAction.cpp`, `CustomAction.def`,
`Product.wxs`).
[[1]](diffhunk://#diff-a7680a20bf0315cff463a95588a100c99d2afc53030f6e947f1f1dcaca5eefd7R597-R806)
[[2]](diffhunk://#diff-79daec0ccfcea63a2f3acb7d811b8b508529921123c754111bbccbea98b2bd74R36-R37)
[[3]](diffhunk://#diff-c12203517db7cde9ad34df9e6611457d1d3c7bc8eb7d58e06739887d3c1034afR115)
[[4]](diffhunk://#diff-c12203517db7cde9ad34df9e6611457d1d3c7bc8eb7d58e06739887d3c1034afR127)
[[5]](diffhunk://#diff-c12203517db7cde9ad34df9e6611457d1d3c7bc8eb7d58e06739887d3c1034afR149)
[[6]](diffhunk://#diff-c12203517db7cde9ad34df9e6611457d1d3c7bc8eb7d58e06739887d3c1034afR205-R210)

**Build and Dependency Updates**

* Added new NuGet package dependencies for Windows App SDK AI and
Runtime to support MSIX and sparse package features
(`Directory.Packages.props`).
* Updated signing pipeline to include the new `PowerToysSparse.msix`
artifact (`.pipelines/ESRPSigning_core.json`).
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

---------

Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com>
2025-10-20 08:52:49 +08:00
Jiří Polášek
b3628aa068 CmdPal: Fix exception logging in ContentFormViewModel (#42460)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

This PR fixes logging entry. The invocation resembled a semantic logger
call, but its signature doesn’t match ManagedCommon.Logger. As a result,
it logged the placeholder text instead of the intended exception value:
```log
[01:43:41.8235422] [Error] ContentFormViewModel.cs::Unexpected HRESULT has been returned from a call to a COM component.::55
    Error building card from template: {Message}
```

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Co-authored-by: Michael Jolley <mike@baldbeardedbuilder.com>
2025-10-17 14:31:47 -05:00
Jiří Polášek
55e974dea4 CmdPal: Fix FiltersViewModel binding (#42467)
## Summary of the Pull Request

This PR resolves crashes on pages with filters, such as Windows Terminal
profiles or Windows Services, when compiled with trimming/AOT.

It removes runtime binding from the FiltersDropDown control, effectively
preventing crashes caused by trimming/AOT dropping binding metadata for
FilterItemViewModel.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #42428
- [x] Closes: #42482
- [x] Related to: #42458
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Co-authored-by: Niels Laute <niels.laute@live.nl>
2025-10-17 09:48:48 -05:00
Dustin L. Howett
92d9f1061c ci: reduce needless file copying; zip GPOs; reliability (#42446)
This pull request makes four main changes to the build.

1. GPOs are now emitted as a ZIP file, rather than a folder to be zipped
later.
2. PDB files are linked into the output folder by hard link, rather than
copy, to save disk space.
3. We no longer copy the entire build output folder into artifacts;
instead, we *move* it, to save disk space.
4. **Failed builds** will no longer produce `build-arch-release`
artifacts; instead, they will produce numbered failure artifacts. This
means that we can finally re-run a single leg of the build, and it will
not fail due to the artifact already existing!

I included a smaller change to the DSC build step to make sure it
doesn't accidentally run when everything else failed. Heh.

Altogether, this takes a couple minutes off the build and reduces the
demand on the agent's disk by 10-15GB.
2025-10-17 17:52:14 +08:00
Copilot
63da56fae0 Remove WiX v3 infrastructure and migrate exclusively to WiX v5 (#41975)
## Summary:

This pull request refactors the installer build pipeline to simplify and
modernize the process, focusing exclusively on the WiX 5 (VNext)
installer and removing legacy WiX 3 support. It eliminates the use of
the `installerSuffix` parameter and related logic, removes the legacy
installer build steps and scripts, and updates documentation to reflect
the new architecture. The changes streamline the pipeline, reduce
complexity, and ensure only the latest installer is built and signed.

Pipeline and build system simplification:

* Removed the `installerSuffix` parameter and all related logic from
pipeline templates and YAML files, including file naming, build steps,
and hash calculation scripts.
* Removed legacy WiX 3 installer build steps and the associated script
`installWiX.ps1`, focusing exclusively on WiX 5 (VNext) installer
builds.

Installer signing and build process updates:

* Updated `.pipelines/ESRPSigning_installer.json` to remove signing
configuration for the legacy `PowerToysSetupCustomActions.dll`, ensuring
only the VNext DLL is signed.

Documentation updates:

* Updated `doc/devdocs/core/installer.md` to remove references to WiX 3,
clarify the installer architecture as WiX 5 only, and describe the new
build process.

## CheckList:
- [ ] Should Build successfully and produce installer for both per user
and per machine
- [ ] Should install without problem

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vanzue <69313318+vanzue@users.noreply.github.com>
Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com>
2025-10-16 16:39:50 -07:00
Jiří Polášek
86fed8aa70 CmdPal: Ensure cached window data is refreshed when the window style changes (#42405)
## Summary of the Pull Request

This PR resolves the issue where the window style WS_EX_TOOLWINDOW was
being set but not properly applied to the window.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #42395
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-10-16 16:34:34 -05:00
Niels Laute
446d1baa6f [CmdPal] Settings UX tweaks (#42303)
## Summary of the Pull Request

Clean up of the Settings app with some minor styling changes.

- Moved activation key related settings into the Activation expander.
- On the Extensions page, seperated the alias settings for improved a11y
- Added a card to the extensions settings frame

<img width="1051" height="935" alt="image"
src="https://github.com/user-attachments/assets/05ae5794-8e30-4af0-aa38-a3f600aa6749"
/>

## PR Checklist

- [ ] Closes: #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

---------

Co-authored-by: Jiří Polášek <me@jiripolasek.com>
2025-10-16 08:38:28 +02:00
Niels Laute
f86d988fb1 Shortcut control visual tweaks (#42302)
## Summary of the Pull Request

Small design tweaks, resolving a visual glitch where the bottom border
of wasn't displayed correctly, and looked jagged on higher res displays

Before vs after

<img width="654" height="450" alt="image"
src="https://github.com/user-attachments/assets/68ab3d24-d18b-4fae-9ffa-3548ce440798"
/>


<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-10-16 08:37:52 +02:00
Kai Tao
cea78c31f8 fix spell complain (#42379)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

- Spell check should not complain
2025-10-16 13:51:40 +08:00
Copilot
f4e9af9acb CmdPal: Windows Terminal extension failing when LOCALAPPDATA environment variable is missing (#42326)
## Summary
Fixes an issue where the Command Palette Windows Terminal Profiles
extension throws an `ArgumentNullException` when the `LOCALAPPDATA`
environment variable is missing or corrupted.

## Problem
The extension uses `Environment.GetEnvironmentVariable("LOCALAPPDATA")`
to locate Windows Terminal settings files. When this environment
variable is missing or corrupted (though rare), the method returns
`null`, which then causes `Path.Combine()` to throw an exception:

```
System.ArgumentNullException: Value cannot be null. (Parameter 'paths')
   at System.IO.Path.Combine(ReadOnlySpan`1 paths)
   at Microsoft.CmdPal.Ext.WindowsTerminal.Helpers.TerminalQuery.GetTerminals()
```

## Solution
Replace `Environment.GetEnvironmentVariable("LOCALAPPDATA")` with the
more robust
`Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)`.
This API:
- Returns the correct path even when environment variables are corrupted
- Never returns `null` for standard special folders
- Is already used elsewhere in PowerToys (e.g.,
`Wox.Plugin.Constant.cs`)

## Changes
- Updated
`Microsoft.CmdPal.Ext.WindowsTerminal/Helpers/TerminalQuery.cs`

## Testing
The fix follows the existing pattern used in the codebase and directly
addresses the exception in the reported stack trace. While unlikely to
affect most users (environment variable corruption is rare), this makes
the extension more resilient to edge cases.

Fixes microsoft/PowerToys#42322

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>CmdPal: Windows Terminal - extension fails to list
profiles when env var is missing</issue_title>
> <issue_description>### Microsoft PowerToys version
> 
> main
> 
> ### Installation method
> 
> Dev build in Visual Studio
> 
> ### Area(s) with issue?
> 
> Command Palette
> 
> ### Steps to reproduce
> 
> The Windows Terminal Profiles built-in extension throws an exception
when environment variables are corrupted. While this is unlikely to be a
widespread issue, we can strengthen the code by replacing the
environment variable with
`Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);`.
> 
> ```
> ============================================================
> 😢 An unexpected error occurred in the 'Windows Terminal Profiles'
extension.
> 
> Summary:
>   Message:    Value cannot be null. (Parameter 'paths')
>   Type:       System.ArgumentNullException
>   Source:     System.Private.CoreLib
>   Time:       2025-10-12 22:19:43.6321869
>   HRESULT:    0x80004003 (-2147467261)
> 
> Stack Trace:
>    at System.ArgumentNullException.Throw(String paramName)
>    at System.IO.Path.Combine(ReadOnlySpan`1 paths)
> at
Microsoft.CmdPal.Ext.WindowsTerminal.Helpers.TerminalQuery.GetTerminals()+MoveNext()
>    at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
> at
Microsoft.CmdPal.Ext.WindowsTerminal.Helpers.TerminalQuery.GetProfiles()
> at Microsoft.CmdPal.Ext.WindowsTerminal.Pages.ProfilesListPage.Query()
> at
Microsoft.CmdPal.Ext.WindowsTerminal.Pages.ProfilesListPage.GetItems()
>    at Microsoft.CmdPal.Core.ViewModels.ListViewModel.FetchItems()
> at
Microsoft.CmdPal.Core.ViewModels.ListViewModel.InitializeProperties()
>    at Microsoft.CmdPal.Core.ViewModels.PageViewModel.InitializeAsync()
> 
> ------------------ Full Exception Details ------------------
> System.ArgumentNullException: Value cannot be null. (Parameter
'paths')
>    at System.ArgumentNullException.Throw(String paramName)
>    at System.IO.Path.Combine(ReadOnlySpan`1 paths)
> at
Microsoft.CmdPal.Ext.WindowsTerminal.Helpers.TerminalQuery.GetTerminals()+MoveNext()
>    at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
> at
Microsoft.CmdPal.Ext.WindowsTerminal.Helpers.TerminalQuery.GetProfiles()
> at Microsoft.CmdPal.Ext.WindowsTerminal.Pages.ProfilesListPage.Query()
> at
Microsoft.CmdPal.Ext.WindowsTerminal.Pages.ProfilesListPage.GetItems()
>    at Microsoft.CmdPal.Core.ViewModels.ListViewModel.FetchItems()
> at
Microsoft.CmdPal.Core.ViewModels.ListViewModel.InitializeProperties()
>    at Microsoft.CmdPal.Core.ViewModels.PageViewModel.InitializeAsync()
> ℹ️ If you need further assistance, please include this information in
your support request.
> ℹ️ Before sending, take a quick look to make sure it doesn't contain
any personal or sensitive information.
> ============================================================
> ```
> 
>
4d47659ff9/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsTerminal/Helpers/TerminalQuery.cs (L64-L78)
> 
> ### ✔️ Expected Behavior
> 
> _No response_
> 
> ###  Actual Behavior
> 
> _No response_
> 
> ### Additional Information
> 
> _No response_
> 
> ### Other Software
> 
> _No response_</issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>

Fixes microsoft/PowerToys#42322

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jiripolasek <4773077+jiripolasek@users.noreply.github.com>
2025-10-15 21:07:09 -05:00
Jaylyn Barbee
50113aa50d 0.95 release note (#42110)
This pull request updates the `README.md` to document the PowerToys 0.95
release. It includes comprehensive updates to release notes, download
links, and roadmap details, reflecting new features, improvements, and
fixes across multiple modules. The changes also improve documentation
for developers and update future planning information.

Release documentation and download updates:
- Updates all download links, release references, and installer
filenames from version 0.94 to 0.95 throughout the README.md to ensure
users get the latest release.
- Revises the release notes to highlight major new features (like
installer upgrade to WiX 5, settings search, hotkey conflict detection,
and module-specific enhancements), and reorganizes the changelog for
clarity.
- Updates the Roadmap section to reflect plans for version 0.96 and
beyond, including new features and ongoing work.

Module and feature highlights:
- Adds or expands sections for each updated module, summarizing key
improvements and new options in each.
- Details significant Command Palette improvements, including
accessibility, stability, UI tweaks, and extension updates.

Developer and documentation improvements:
- Adds new documentation for the Light Switch module.
- Improved developer workflow with updated dependencies, build scripts,
and enhanced test coverage.
- Enhanced CI pipeline and test stability with new configuration,
automated log collection, and accessibility improvements.

---------

Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Dave Rayment <dave.rayment@gmail.com>
Co-authored-by: Kai Tao <kaitao@microsoft.com>
Co-authored-by: Jiří Polášek <me@jiripolasek.com>
2025-10-15 23:18:52 +00:00
Kai Tao
7830466b81 Cmdpal: Use static link instead of dynamic to solve cmdpal crash in sandbox (#42355)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

As title

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-10-15 18:43:37 +08:00
Kai Tao
cca66eacd0 Light switch: Add new tag to light switch (#42351)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
<img width="444" height="387" alt="image"
src="https://github.com/user-attachments/assets/03e179c6-63cc-4824-b601-a7846200607f"
/>
2025-10-15 14:47:32 +08:00
Shawn Yuan
7b9d5af8c1 fixed light switch shortcut not working issue (#42340)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This pull request refactors how the `ToggleThemeHotkey` property is
handled in the LightSwitch settings and view model. The changes simplify
property management by directly referencing the property within
`LightSwitchProperties` and ensure that the hotkey setting is
consistently updated and serialized.

**Settings property management:**

* In `LightSwitchSettings.Clone()`, the `LightSwitchProperties` object
now directly references the existing property instances instead of
creating new ones, and also includes the `ToggleThemeHotkey` property.

**View model property handling:**

* In `LightSwitchViewModel.ToggleThemeActivationShortcut`, the getter
and setter now directly access and update
`ModuleSettings.Properties.ToggleThemeHotkey.Value`, removing the need
for a backing field and ensuring changes are properly serialized and
notified.
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #42330
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

---------

Signed-off-by: Shawn Yuan (from Dev Box) <shuaiyuan@microsoft.com>
2025-10-14 10:45:10 -04:00
Dave Rayment
471022e842 [Awake] Fix for countdown timer drift (#41684)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

- Fixes the countdown timer drift issue #41671 
- Includes minor refactoring to consolidate identical timer completion
code in `SetExpirableKeepAwake` and `SetTimedKeepAwake`.
- Removes the ~50 day restriction on timed keep-awake. The timer may now
be `uint.MaxValue` seconds, or ~136 years.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #41671
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

This replaces the combined `Observable.Timer` and `Observable.Interval`
timers with a single 1-second Interval timer which checks against a
fixed expiry time.

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Checked that:
1. The timed keep-awake works via the `--time-limit` parameter, and
expiry occurs on time.
2. The countdown timer in the systray menu correctly counts down for
small values:

<img width="386" height="109" alt="image"
src="https://github.com/user-attachments/assets/b282dfd8-38e7-48ab-b17c-99756ef73b99"
/>

3. The countdown timer in the systray menu counts down for larger values
than were previously possible:

<img width="380" height="104" alt="image"
src="https://github.com/user-attachments/assets/7a807a37-8945-4048-a86c-05e6ac9310a9"
/>

4. On a heavily CPU-loaded system, the previous countdown drift does not
happen.
5. The expirable keep-awake mode still functions as expected.
2025-10-14 16:52:27 +08:00