Commit Graph

4711 Commits

Author SHA1 Message Date
Dave Rayment
0087d2d576 [Build] Separate WinRT props from common .NET props, make verify script more robust and faster (#48059)
<!-- 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
Separates out the common .NET build properties from
**Common.Dotnet.CsWinRT.props** into a new file so POCO libraries don't
have to import WinRT or add exclusions to **verifyCommonProps.ps1**.
Also updates the verify script for robustness and speed.

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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [x] **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 is a follow-on from #47211, which included a C# project that didn't
target WinRT. Previously, all C# projects were mandated to include
**Common.Dotnet.CsWinRT.props**, even if they didn't need the WinRT
import, because the common .NET build properties like `TargetFramework`
and Debug/Release configuration were included in the same file.

This PR separates out the non-WinRT information into a new
**Common.Dotnet.props** file. The existing
**Common.Dotnet.CsWinRT.props** file imports this, meaning no changes
are required for existing C# projects.

Additionally, the **verifyCommonProps.ps1** script has been updated to
remove redundant exclusions, add checks for malformed XML, and to speed
up the scan.

### Changes to verifyCommonProps.ps1
The following updates were made:

- Added descriptive header and param info.
- Now using .NET's `EnumerateFiles()` instead of Powershell's slow file
enumeration.
- Now using `XmlDocument.Load()` to quickly load the content of the
file.
- Parsing the document now uses `GetElementsByTagName()` with a '*'
wildcard for the namespace to pull out `Import` tags regardless of
location or ns prefix.
- Removed prior exclusions for **Microsoft.CmdPal.Core.*** and
**Microsoft.CmdPal.Ext.Shell** projects. There are no Core projects any
longer and the **Microsoft.CmdPal.Ext.Shell** project already includes
an import for **Common.Dotnet.CsWinRT.props**.
- Filename comparisons now use an exact match to the filename itself
rather than a wildcard substring match. This means the check is robust
against project names with the same suffix.
- Early exit `break` on successful match, so the whole file need not be
scanned.
- `try/catch` added to prevent a .csproj XML parsing error from breaking
the CI.

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

- Built all Quick Accent projects and confirmed all unit tests passed.
- Edited a .csproj to exclude the end tag. Ran **verifyCommonProps.ps1**
to confirm the parsing error was reported.
- Edited **verifyCommonProps.ps1** to remove the exclusion for
**TemplateCmdPalExtension.csproj**. Ran the script to confirm that the
file was correctly flagged.
- Edited **PowerAccent.Common.csproj** to remove the Import for
**Common.Dotnet.props**. Ran the verify script to confirm that the file
was correctly flagged.
- Edited **PowerAccent.Core.csproj** to remove the Import for
**Common.Dotnet.CsWinRT.props**. Ran the verify script to confirm that
the file was correctly flagged.

## Verify Script Performance

File cache|Before (ms)|After (ms)
--|--|--
Cold|3123|1739
Warm|1849|686
2026-08-18 06:44:10 +00:00
Sthitadhi Maity
93aeae9aa1 Add regression test for issue #49838 (#49867)
## Summary of the Pull Request

Adds a regression test guarding against re-introduction of a hardcoded
`ReasoningEffort` value in
`SemanticKernelPasteProvider.CreateExecutionSettings()`. This value
previously broke every OpenAI/Azure OpenAI custom paste action for
models that don't support `reasoning_effort: minimal`, causing HTTP 400
errors (see #49838).

The underlying fix already exists on `main` —
`CreateExecutionSettings()` no longer sets `ReasoningEffort`, and the
Phi Silica on-device provider has since been split into its own
`PhiSilicaPasteProvider` class. This PR does not modify provider logic;
it adds test coverage to prevent this specific regression from being
reintroduced.

## PR Checklist

- [x] Closes: #xxx
_(Not applicable — this PR does not close #49838, since the underlying
fix already landed separately. Filed to add regression coverage only.)_
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
_(Not yet discussed with core contributors — flagging that this is a
test-only addition in response to already-observed regression risk, and
happy to adjust scope/approach based on maintainer feedback.)_
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end-user-facing strings can be localized
  _(N/A — no user-facing strings changed.)_
- [x] **Dev docs:** Added/updated
  _(N/A — internal test-only change, no dev docs affected.)_
- [x] **New binaries:** Added on the required places
  _(N/A — no new binaries introduced.)_
- [x] **Documentation updated:** If checked, please file a pull request
on our docs repo and link it here: #xxx
  _(N/A — no user-facing documentation changes.)_

## Detailed Description of the Pull Request / Additional comments

Issue #49838 reported that Advanced Paste custom actions fail with HTTP
400 for OpenAI/Azure OpenAI models that don't support `reasoning_effort:
minimal`, a value that was hardcoded in
`SemanticKernelPasteProvider.CreateExecutionSettings()` (originally
introduced in #46727 alongside the Phi Silica on-device provider).

By the time this was investigated, the hardcoded value had already been
removed from `main`, and the code now includes an explicit comment
warning against reintroducing model-specific tuning properties in this
shared method. However, there was no test enforcing that guarantee —
meaning a future change could silently reintroduce the same class of bug
(this is the second time this exact pattern has caused a regression; see
#43766 for the first).

This PR adds a unit test in `AdvancedPaste.UnitTests` that constructs an
OpenAI-configured `SemanticKernelPasteProvider` and asserts that
`CreateExecutionSettings()` returns an `OpenAIPromptExecutionSettings`
object with `ReasoningEffort` left unset. No production code is
modified.

## Validation Steps Performed

- Added the new unit test to `AdvancedPaste.UnitTests`.
- Ran the test locally against the current `main` branch and confirmed
it passes.
- Confirmed no other tests in the `AdvancedPaste.UnitTests` project were
affected by this change.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-08-18 06:28:18 +00:00
Subhrajyoti Singha
6d903a42e1 [CmdPal] Add "Update and restart" / "Update and shut down" system com… (#49437)
## Summary of the Pull Request

Adds **Update and restart** and **Update and shut down** to the Windows
System Commands extension, matching what Windows shows in the Start menu
power flyout when updates are waiting for a reboot.

Both only show up while Windows Update is actually waiting on a restart.
When nothing is pending, the command list is exactly what it is today.

## PR Checklist

- [x] Closes: #48849
- [x] **Communication:** commented on the issue before starting;
zadjii-msft had greenlit the idea as long as the commands actually do
something rather than just report status
- [x] **Tests:** added and passing (27/27)
- [ ] **Localization:** 6 new resx strings, each with a translator
comment
- [ ] **Dev docs:** n/a
- [ ] **New binaries:** n/a

## Detailed Description of the Pull Request / Additional comments

**Detecting the pending update.**
`WindowsUpdateHelper.IsUpdatePending()` reads
`ISystemInformation::RebootRequired` from WUAPI, which is the same
signal the Start menu uses, so the commands appear exactly when Windows
would offer them itself.

A few notes on that file, since the interop is a bit unusual:

- I used `[GeneratedComInterface]` rather than `ComImport` to keep it
AOT-compatible.
- `ISystemInformation` is a dual interface, so its first four vtable
slots belong to `IDispatch`. They're declared as placeholder methods
that are never called, and the two real members follow in vtable order.
- The result is cached for 5 seconds. `GetItems()` runs on every
keystroke and would otherwise create a COM object each time — same
reasoning as the existing network info cache in this extension.
- If anything goes wrong (COM creation fails, an exception is thrown) it
falls back to "no update pending", so the commands stay hidden and the
extension behaves exactly as it does now. The failure is logged through
`ExtensionHost.LogMessage`.

**Running the command.** `InitiateShutdown` with
`SHUTDOWN_INSTALL_UPDATES` plus either `SHUTDOWN_RESTART` (0x44) or
`SHUTDOWN_POWEROFF` (0x48). That first flag is what makes this "update
and restart" instead of a plain restart. `SeShutdownPrivilege` is
disabled by default on the process token, so it gets enabled first.

**Wiring.** Both items use the existing `ExecuteCommandConfirmation`
flow, so they respect the "confirm system commands" setting like the
other commands here. They're registered on the System Commands page and
the top-level search fallback, with stable ids
(`...system.update_restart`, `...system.update_shutdown`).

## One question for reviewers

`ShowDialogToConfirmCommand` defaults to `false`, so out of the box
these run immediately when you press Enter, the same as the existing
Shutdown and Restart commands. I kept them consistent rather than
special-casing them, but I hit this myself while testing — I pressed
Enter and my machine started updating and rebooting straight away, which
was a bit of a surprise. Happy to force a confirmation for these two
regardless of the setting if you'd prefer that.

## Validation Steps Performed

27/27 unit tests pass. The 5 new test methods cover the commands being
present/absent in both states, query matching, stable ids, the 0x44 /
0x48 flag values, and that the real WUAPI call doesn't throw.

I also tested it on a machine with a genuine pending update, confirmed
via WUAPI `RebootRequired` and the Windows Update and CBS registry keys:

1. **Before** — the installed 0.11 build, same machine, same pending
update: no update commands.
2. **After** — this build: both commands show up, in the same situation
the Start menu offers them.
3. **Search** — typing `update` matches both, which is the
discoverability gap the issue is about.
4. **Actually ran it** — pressing Enter on "Update and restart"
installed the pending update (KB5121767) and restarted the machine.
After it came back up, `RebootRequired` was false and the two commands
were correctly gone from the list.

### Screenshots

**1. Before**
<img width="785" height="473" alt="Screenshot 2026-07-21 214038"
src="https://github.com/user-attachments/assets/27b12a4c-f636-4815-b8e2-fc918282959b"
/>

**After**
<img width="762" height="445" alt="Screenshot 2026-07-21 215452"
src="https://github.com/user-attachments/assets/80e1936d-af67-48ab-91b4-59b94fb56827"
/>
<img width="762" height="149" alt="pr48849-search-update"
src="https://github.com/user-attachments/assets/53b7f065-4b7c-4317-9e66-e621eed44e61"
/>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 22:15:25 +00:00
Michael Jolley
6fc7f2d058 [CmdPal] Rank global fallbacks by their title match (#49983)
Fallbacks were always getting buried under fuzzy junk, even though their
title matched exactly what you typed. The recent MainListPage ranking
overhaul pinned every fallback to the bottom tier, so a perfect match
was treated the same as no match at all.

Global fallbacks now earn the tier their title/subtitle actually
deserves. A fallback resolves a live title from your query, so when that
title matches exactly (like "Reload" for "reload"), it ranks right
alongside a real command's exact match instead of getting floored.
Fallbacks that don't match anything still drop to the floor, so
always-available handlers like Run command and web search keep showing
without crowding the top.

Non-global fallbacks stay in their own bottom section like before.



https://github.com/user-attachments/assets/685b8cc2-3a69-4ea8-91a9-cfba08a1d23c

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e51d0ce1-d74f-4a27-ac29-9cb9b86ddbee
2026-08-17 19:58:41 +00:00
Alex Mihaiuc
fe9dd6ef5c Protect ZoomIt audio initialization from race on failure (#49912)
This could end up in a deadlock upon trying to record while the previous
recording was still initializing but in an error state.

<!-- 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
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-17 20:32:30 +02:00
moooyo
f510c972f7 [Color Picker] Handle default display refresh-rate sentinel values (#49973)
## Summary of the Pull Request

Treats `dmDisplayFrequency` values `0` and `1` as the display hardware's
default refresh rate instead of literal frequencies.

Color Picker now retains its existing 60 Hz fallback for these sentinel
values, preventing a timer interval overflow for `0` and one-second
sampling for `1`. Valid refresh rates greater than `1` remain unchanged.

## PR Checklist

- [x] Closes: #49971
- [ ] **Communication:** The issue has been filed for triage; this
change has not yet been discussed with core contributors
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** No end-user-facing strings were added
- [ ] **Dev docs:** Not applicable for this implementation-only bug fix
- [ ] **New binaries:** No new binaries were added
- [ ] **Documentation updated:** Not applicable; no user-facing
documentation contract changed

## Detailed Description of the Pull Request / Additional comments

`GetMainDisplayRefreshRate` now accepts a reported refresh rate only
when it is greater than `1`. Otherwise, it keeps the existing 60 Hz
fallback.

A small test seam and unit tests cover reported values `0`, `1`, `60`,
and `144`. The correct `InternalsVisibleTo` entry is added for the
existing `ColorPickerUI.UnitTests` assembly.

This issue was discovered while reviewing #49855, but it is an existing
bug and this PR targets current `main` independently. Since #49855 also
changes the refresh-rate code, whichever PR merges second may need a
trivial rebase that preserves the `> 1` sentinel handling.

No settings schema, IPC contract, dependencies, installer content, or
production binaries were changed.

## Validation Steps Performed

- `tools\build\build-essentials.cmd -Platform x64 -Configuration Debug`:
passed with exit code 0, 0 warnings, and 0 errors.
- `tools\build\build.cmd -Platform x64 -Configuration Debug` from
`ColorPickerUI.UnitTests`: passed with exit code 0, 0 warnings, and 0
errors.
- Full `vstest.console.exe` run for `ColorPickerUI.UnitTests.dll`: **382
passed, 0 failed**.
- `git diff --check`: passed.

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
2026-08-17 08:58:36 +00:00
Niels Laute
4494a96be6 chore(common): remove unused shared UI dependencies (#49895)
## Summary of the Pull Request

Removes unused dependencies, stale API surface, and unreachable managed
settings deep-link aliases from the shared UI libraries.

## PR Checklist

- [x] **Communication:** Cleanup scope was reviewed before
implementation
- [x] **Tests:** No automated tests were needed for unused
dependency/API removal; affected projects build successfully
- [x] **Localization:** No end-user-facing strings are changed
- [x] **New binaries:** No new binaries are introduced

## Detailed Description of the Pull Request / Additional comments

- Removes unused `CommunityToolkit.WinUI.Controls.Primitives` and
`CommunityToolkit.WinUI.Converters` package references from
`src/common/Common.UI.Controls/Common.UI.Controls.csproj`.
- Removes the unused `FlyoutWindowHelper.GetDpiScale(WindowEx)` overload
from `src/common/Common.UI.Controls/Window/FlyoutWindowHelper.cs`.
- Removes the unused `SettingsDeepLink.SettingsWindow.PowerDisplay`
value; PowerDisplay uses its module-local settings deep-link helper.
- Removes unreachable `Run` and `PowerPreview` managed aliases,
superseded by `PowerLauncher` and `FileExplorer`, plus their dead CmdPal
lookup cases.
- Preserves the runner's raw `--open-settings=Run` and
`--open-settings=PowerPreview` routes for backward compatibility.
- Intentionally leaves the existing WinForms configuration and
compatibility project references unchanged.

## Validation Steps Performed

- Built `src/common/Common.UI/Common.UI.csproj` for x64 Debug.
- Built `src/common/Common.UI.Controls/Common.UI.Controls.csproj` for
x64 Debug.
- Built
`src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.PowerToys/Microsoft.CmdPal.Ext.PowerToys.csproj`
for x64 Debug.
- Ran `git diff --check`.

---------

Copilot-Session: f4b96463-079f-47c2-ae9b-7f4c59baf591
2026-08-17 16:56:54 +08:00
moooyo
75df8d022a [Image Resizer] Fix CLI input validation and diagnostics (#49854)
## Summary of the Pull Request

Closes #49852.

Image Resizer CLI previously accepted several invalid inputs as
successful work: unknown options could be consumed as file arguments,
invalid files were silently dropped, unsafe dimensions could reach the
resize engine, and equivalent inputs could process the same source
concurrently.

This change makes `PowerToys.ImageResizerCLI.exe` strict, deterministic,
and diagnosable while preserving the existing lenient command-line
behavior used by the GUI and context-menu path.

## PR Checklist

- [x] Closes: #49852
- [x] **Communication:** Discussed with core contributors
- [x] **Tests:** Added/updated
- [x] **Localization:** End-user-facing diagnostics are localizable
- [x] **Dev docs:** Built-in CLI help and examples updated; no
standalone dev-doc change required
- [x] **New binaries:** No new binaries introduced
- [x] **Documentation updated:** No external user-documentation change
required

## Detailed Description

### Strict CLI parsing without breaking supported syntax

- Adds a strict parse path for the public CLI while keeping the
GUI/context-menu parser lenient.
- Rejects unknown option-like positional tokens before processing.
- Preserves `--`, response files, attached values such as `-w100`, legal
bundles such as `-rq85`, and explicit attached boolean values such as
`-rtrue`.
- Preserves valid file, pipe, and destination values for lenient callers
when another option fails conversion.

### Deterministic and diagnosable input resolution

- Expands wildcards in the final path segment and reports zero-match
patterns.
- Reports missing, unsupported, invalid, and empty inputs instead of
silently filtering them.
- Processes valid files in mixed batches, reports every rejected input,
and returns a non-zero exit code.
- Canonicalizes filesystem paths before deduplication, covering normal,
extended (`\\?\`), long, casing, and parent-reparse aliases while
preserving distinct hard links, final symbolic links, and files in
case-sensitive directories.
- Applies the same strict validation and deduplication to public-CLI
named-pipe input; the GUI/context-menu pipe remains lenient.
- Treats an empty public-CLI pipe as an error.
- Reads redirected stdin using the producing shell's output encoding
with BOM detection, including non-ASCII paths from default cmd and
PowerShell pipelines.

### Validation before file writes

- Rejects negative, non-finite, zero/zero, grouped out-of-range, and
otherwise unsupported custom dimensions.
- Requires a positive effective width for percentage-based Fit and Fill
sizes.
- Treats an out-of-range preset index as an error instead of continuing
with the current preset.
- Validates resize-engine dimensions before integer conversion and
before destination creation.
- Rounds positive fractional Fill targets safely to at least one pixel.
- Deduplicates equivalent paths before parallel processing so
overlapping explicit/glob/pipe inputs cannot race under `--replace`.

### Diagnostics and compatibility

- Includes exception type and HRESULT when a decoder exception has an
empty message.
- Documents and warns that shrink-only remains ignored for
percentage-based sizes, preserving existing behavior.
- Preserves the original UTC modified time after `KeepDateModified +
Replace` by restoring it on the final replaced file.

## Validation

Validation was repeated after merging the latest `main` (`e753ec51fb`)
into the PR branch.

1. Restored with the configured host `NuGet.Config` and built
`src/modules/imageresizer/ImageResizerCLI/ImageResizerCLI.csproj` in x64
Release using `tools/build/build.ps1`.
   - Result: exit code 0; errors log empty.
2. Restored and built
`src/modules/imageresizer/tests/ImageResizer.UnitTests.csproj` in x64
Release with the same build script and configured package source.
   - Result: exit code 0; errors log empty.
3. Ran the complete x64 Release Image Resizer unit-test assembly with
Visual Studio `vstest.console.exe`.
   - Result: **205 passed, 0 failed, 0 skipped**.
4. Ran 10 process-level CLI regressions covering:
   - attached boolean parsing (`-rtrue`);
   - grouped out-of-range dimensions without source modification;
   - positive fractional Fill producing a valid `1x100` image;
   - normal/extended/wildcard path deduplication;
- non-ASCII redirected stdin from default PowerShell 7 and cmd
pipelines;
   - empty, invalid, and duplicate named-pipe inputs;
- `KeepDateModified + Replace`, including content change and exact UTC
timestamp preservation.
   - Result: **10/10 passed**.
5. Confirmed both build error logs remained empty, all temporary
fixtures were removed, and the real Image Resizer settings file retained
its original length, timestamp, and SHA-256 hash.

The new Image Resizer UI-test project added on `main` was not run
locally because it requires the repository's WinAppDriver/local-VM
UI-test environment; this PR does not change that UI-test project.

---------

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
2026-08-17 08:50:51 +00:00
Jiří Polášek
f1548fcf8b CmdPal: Fix Dock refresh resource leak (#49742)
## Summary of the Pull Request

This PR improves Dock band refresh and partially eliminates our favorite
leak:

- Reuses Dock item view models while their source items remain stable.
- Coalesces bursty ItemsChanged notifications into a single follow-up
refresh.
- Cleans replaced and discarded view models after applying UI updates.
- Prevents queued refreshes from repopulating bands after cleanup.
- Handles unavailable UI schedulers without abandoning created view
models.
- Adds unit tests for reuse and cleanup.


## Pictures? Pictures!

Before

<img width="1671" height="400" alt="image"
src="https://github.com/user-attachments/assets/3a0874e6-eded-44f0-8bc2-bfa223e2888d"
/>


After

<img width="1671" height="716" alt="image"
src="https://github.com/user-attachments/assets/1560bfdb-5701-40bd-9f20-d4e885159ab8"
/>


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

- [x] Closes: #49428
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-14 17:44:55 -05:00
Michael Jolley
bcb2ed6dc7 CmdPal: Fix Command Palette Dock breaking on monitor topology changes (#49814)
Docking or undocking a laptop, or flipping display modes with Win+P, can
leave the Dock empty, missing, or misconfigured. Fixes #48516.

The root of it: the Dock's per-monitor config leans on a stable hardware
ID for each monitor. Right after a `WM_DISPLAYCHANGE`, before Windows
has settled the new topology, that lookup can come back empty or fall
back to a volatile GDI name. The reconciler then reads that as "hey, a
new monitor showed up" and creates a fresh, disabled, empty config for a
monitor that never actually left. On top of that, a burst of
`WM_DISPLAYCHANGE` messages during a mode switch each triggered an
immediate write to settings, so one bad intermediate snapshot could get
baked in permanently. And since only the Dock window itself was
listening for `WM_DISPLAYCHANGE`, the Settings page's monitor list could
go stale whenever no Dock window happened to be alive.

## The plan

- Retry the stable-ID lookup a few times before giving up and falling
back to the volatile name.
- Debounce monitor-change handling so a flurry of `WM_DISPLAYCHANGE`
events settles down before we reconcile and persist, instead of writing
every half-finished intermediate state.
- Have the main window forward `WM_DISPLAYCHANGE` too, so the monitor
cache stays fresh even when the Dock is off or has no windows up.
- Teach the reconciler to reassociate a secondary monitor's config with
its new ID when there's exactly one unmatched monitor and one unmatched
config, the Win+P round trip case, instead of treating it as new
hardware.
- Added tests covering the transient ID fallback, the ambiguous
multi-monitor case, and the Win+P reassociation.

Scaling behavior when the Dock lands on a monitor with a different DPI
is a separate issue (#48466) and isn't touched here.

---------

Copilot-Session: d2bc281b-062c-4e6e-9356-bdb7a2ef9e1e
2026-08-14 16:52:18 -05:00
Jiří Polášek
8d463be70c CmdPal: Ignore failed package catalog completion events (#49887)
## Summary of the Pull Request

This PR prevents Command Palette from processing failed package
lifecycle operations as successful extension changes.

`PackageCatalog` can report an operation as complete while exposing the
failure through `ErrorCode`. Previously, `WinRTExtensionService` checked
only `IsComplete`, allowing failed installation, uninstallation, and
update operations to enter extension handling.

- Adds a shared `IsSuccessfulPackageOperation` check requiring both
    - the package operation to be complete, and
    - the projected `ErrorCode` to be null.
- The check is applied to catalog event:
    - `PackageInstalling`
    - `PackageUninstalling`
    - `PackageUpdating`


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

- [x] Closes: #49886
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-14 14:52:35 -05:00
Niels Laute
446bb9f241 [Shortcut Guide] Add page-local search (#49639)
## Summary of the Pull Request

Adds an accessible search box to the Shortcut Guide title bar that
filters shortcuts on the currently selected application page.

The query matches shortcut names, descriptions, modifier names, and
displayed key labels while preserving the existing pinned, recommended,
category, and taskbar grouping.

## PR Checklist

- [x] Closes: #48791
- [x] **Communication:** The UX and behavior were discussed before
implementation
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end-user-facing strings can be localized
- [x] **Dev docs:** Added/updated
- [ ] **New binaries:** Not applicable
- [ ] **Documentation updated:** Not applicable

## Detailed Description of the Pull Request / Additional comments

- Adds a localized title-bar `AutoSuggestBox` with a find icon and UI
Automation identity.
- Filters only the selected app page using case-insensitive matching
across names, descriptions, modifiers, virtual-key display names, and
rendered special-key aliases.
- Keeps only sections containing matches and shows a polite live-region
no-results state with correct pane spacing.
- Preserves the query when switching app pages, but clears it when
Shortcut Guide closes.
- Adds `Ctrl+F` to focus search; the first `Escape` clears a query and
the next closes the overlay.
- Keeps query text local to the UI with no logging or telemetry.

Related issues: #48860 requests several broader navigation/readability
changes; #49459 requests direct physical-key interception rather than
text search.

## Screenshots

### Filter Windows shortcuts by displayed key label

<img
src="https://raw.githubusercontent.com/niels9001/PowerToys/pr-assets-shortcut-guide-search/.github/pr-assets/shortcut-guide-search/windows-alt-filter.png"
width="667" alt="Shortcut Guide Windows page filtered by Alt" />

### Keep the query while switching to the PowerToys page

<img
src="https://raw.githubusercontent.com/niels9001/PowerToys/pr-assets-shortcut-guide-search/.github/pr-assets/shortcut-guide-search/powertoys-opa-filter.png"
width="660" alt="Shortcut Guide PowerToys page filtered by opa" />

## Validation Steps Performed

- Built `ShortcutGuide.Ui` for ARM64 Debug with the repository build
scripts.
- Built `ShortcutGuide.UnitTests` for ARM64 Debug and passed all 23
tests (16 search cases plus 7 existing tests) with `vstest.console.exe`.
- Verified via UIA and guarded keyboard input that name/key-label
filtering updates immediately, empty sections disappear, and no matches
show the localized live-region state.
- Verified the query persists when switching Windows to PowerToys,
`Ctrl+F` focuses search, first `Escape` clears, second `Escape` closes,
and reopening starts with an empty query.
- Rebuilt after the final no-results accessibility and 16px top-margin
adjustment.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b8ffa76b-3cf0-4a67-9adb-a13c5dd9f125
Copilot-Session: 4a96c2c2-6954-4784-8257-e0de0fac15a7
Copilot-Session: 1f00def4-e790-4071-96c6-a81c9c2adba5
Copilot-Session: 76e284a6-9a03-4105-bae6-4ed7fc92042d
2026-08-14 07:32:02 +00:00
Niels Laute
215382050e [CmdPal] Settings UX tweaks (#49865)
## Summary of the Pull Request

Simplifies the Command Palette settings experience by removing obsolete
extension-discovery UI, introducing clearer semantic sections, and
reducing repetitive setting copy.

- Removes the Store discovery banner from the Installed extensions page
now that Gallery is the primary discovery surface in
`src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/ExtensionsPage.xaml`.
- Uses the existing section-header `TextBlock` pattern to organize
General and Personalization without introducing another settings-group
control.
- Regroups General settings into Activation, App behavior, For
developers, and About sections in
`src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/GeneralPage.xaml`.
- Regroups Personalization settings into Appearance, Layout and
positioning, and Interaction sections in
`src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/AppearancePage.xaml`.
- Moves compact mode, monitor placement, and notification placement to
Personalization, while preserving their existing bindings and automation
IDs.
- Clarifies compact-mode positioning with a horizontal slider and
directional description.


<img width="941" height="449" alt="Screenshot 2026-08-13 135040"
src="https://github.com/user-attachments/assets/01a53ab1-302b-4ce1-8537-0cc96aca459f"
/>

<img width="941" height="754" alt="Screenshot 2026-08-13 135103"
src="https://github.com/user-attachments/assets/2bae516c-75d3-4504-84e7-070e6b654281"
/>

<img width="710" height="719" alt="Screenshot 2026-08-13 135251"
src="https://github.com/user-attachments/assets/9aad14bb-9089-4cf6-9d7f-674171a22e9c"
/>

## PR Checklist

- [x] **Communication:** The settings UX was discussed and iterated with
Command Palette contributors.
- [x] **Tests:** No automated tests were added because these are
settings layout and copy changes; the CmdPal UI project builds
successfully.
- [x] **Localization:** All end-user-facing strings are stored in
`src/modules/cmdpal/Microsoft.CmdPal.UI/Strings/en-us/Resources.resw`.

## Detailed Description of the Pull Request / Additional comments

The Installed extensions page no longer promotes the Microsoft Store
because extension discovery now lives in Gallery. The search field is
promoted to the top of the page and the obsolete Store command and
visual resources are removed.

General and Personalization now use the section-header `TextBlock` style
already established in CmdPal settings. `SettingsExpander` remains
reserved for stronger parent-child relationships, such as activation
shortcut options and compact-mode positioning. The independent **Keep
search text when reopened** and **Select search text when opened**
options remain separate toggle cards.

Compact mode is now labeled **Open with a compact search box**. Its
nested **Vertical search box position** setting uses a horizontal slider
without an icon and explains how left/right maps to lower/higher screen
placement.

## Validation Steps Performed

- Formatted the changed XAML with the repository XamlStyler
configuration.
- Built
`src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj` for
x64 Debug with `tools/build/build.ps1`.
- Launched the freshly staged development package and manually inspected
the Extensions, General, and Personalization pages.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e1966eaa-1e92-4e8a-a4fa-ce27539e508f
Copilot-Session: 120899e5-fc77-425e-918b-644929b65739
2026-08-14 08:33:58 +02:00
Noraa Junker
6c9fb8ce52 [Shortcut Guide] Add Windows key hold activation options (#49661)
## Summary of the Pull Request

Adds configurable Windows-key hold activation to Shortcut Guide while
keeping the regular activation shortcut independent.

Users can choose to disable Windows-key activation, show taskbar
indicators, or open the full Shortcut Guide. Full-guide mode also
supports a configurable hold duration and optional close-on-release
behavior.

<img width="1099" height="611" alt="image"
src="https://github.com/user-attachments/assets/e0fe4c0f-3bef-43f8-a526-d22caf9e484e"
/>


## PR Checklist

- [ ] Closes: N/A
- [x] **Communication:** The UX and behavior were discussed before
implementation
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end-user-facing strings can be localized
- [x] **Dev docs:** Added/updated
- [ ] **New binaries:** Not applicable
- [ ] **Documentation updated:** Not applicable

## Detailed Description of the Pull Request / Additional comments

- Adds Off, taskbar-indicator, and full-guide Windows-key actions to
Settings.
- Adds a 100–5,000 ms hold-duration setting and a full-guide
close-on-release option.
- Handles left and right Windows keys and suppresses Start after an
activated hold.
- Routes Windows-key holds through a dedicated event so custom
activation shortcuts remain independent.
- Clears previous pressed-key registrations before refreshing them to
prevent duplicate long-press callbacks.
- Preserves compatibility with the existing `press_time` setting and
documents the new options.

## Validation Steps Performed

- Built the affected ARM64 Debug Settings, Runner, Shortcut Guide
module-interface, and Shortcut Guide UI projects.
- `ShortcutGuide.UnitTests`: 7/7 passed.
- Targeted Settings tests: 12/12 passed.
- Manually verified Off, taskbar-indicator, full-guide close-on-release,
and full-guide persistent modes.
- Verified configured hold thresholds, both Windows keys, Start
suppression, and regular-shortcut independence.
- Validated the final Settings XAML layout in the running Settings app.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Muyuan Li (from Dev Box) <muyuanli@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2b3acca3-e49b-4936-8fb9-6f669bd449db
2026-08-13 22:27:39 +02:00
Niels Laute
b7891108fa [Mouse Highlighter] Update default click colors (#49833)
## Summary of the Pull Request

Updates Mouse Highlighter's default click colors to the recommended
palette colors:

- Left click: green (`#BFFF00`)
- Right click: blue (`#00BFFF`)

Keeps the Settings UI, native module fallback, and DSC reference aligned
while preserving the existing 65% opacity. Existing saved preferences
are unchanged.

## PR Checklist

- [ ] Closes: N/A
- [x] **Communication:** Requested by a core contributor
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** No end-user-facing strings changed
- [x] **Dev docs:** Updated the Mouse Highlighter DSC reference
- [ ] **New binaries:** No new binaries
   - [ ] JSON for signing
   - [ ] WXS for installer
   - [ ] YML for CI pipeline
   - [ ] YML for signed pipeline
- [ ] **Documentation updated:** No external documentation update
required

## Detailed Description of the Pull Request / Additional comments

Adds shared managed constants for the two click-color defaults so
serialized settings and Settings UI fallback behavior cannot drift. The
native Mouse Highlighter fallback uses the same RGB values, and a
focused unit test locks down the defaults.

## Validation Steps Performed

- Built `MouseHighlighter.vcxproj` for x64 Debug
- Built `Settings.UI.UnitTests.csproj` for x64 Debug
- Passed
`MouseHighlighterSettingsTests.Defaults_ShouldUseRecommendedClickColors`

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-13 17:11:49 +00:00
st-gr
69a600e249 feat(File Explorer): Add configurable local image rendering to Markdown previewer (#47857)
## Summary
- Adds a "Show local images" toggle in PowerToys Settings (File Explorer
> Markdown)
- When enabled, renders images referenced via relative paths or local
file paths in the Markdown preview pane
- Serves validated local image files on a WebView2 virtual host
(`https://localmdimages/`) directly from the handler's resource filter
- Supports local paths and UNC/network share paths
- Default: OFF (preserves existing behavior)
- GPO support: Admins can force-enable or force-disable via Group Policy

Fixes #40787
Fixes #3713

## Security model

| Scenario | Behavior |
|----------|----------|
| Setting OFF (default) | All images blocked, info bar shown. Raw HTML
`src` is rewritten to `#` in this state too, so a `data:` image cannot
render (it is resolved internally and never reaches the resource filter)
|
| Setting ON + relative path (`media/img.png`) | Resolved against .md
directory, rendered if under that tree |
| Setting ON + path traversal (`../../secret.png`) | Blocked — resolved
with `Path.GetFullPath` and checked with `Path.GetRelativePath`,
including percent-encoded traversal on the serving side |
| Setting ON + junction/symlink below the allowed path | Blocked — each
component of the resolved path is rejected if it carries
`FileAttributes.ReparsePoint`, since lexical containment alone does not
prevent redirection |
| Setting ON + UNC relative path (`images/pic.png` on `\\server\share`)
| Allowed within share root |
| Setting ON + remote URL (`https://evil.com/track.png`) | Always
blocked |
| data:/javascript: URI | Always blocked, in both setting states |
| `srcset` on a raw HTML `<img>` | Attribute removed, in both setting
states — its candidates are not validated by the `src` sanitizer |
| Script execution | Always disabled (`IsScriptEnabled = false`) |
| Mark-of-the-Web (MotW) | Explorer blocks preview of MotW-tagged files
before our code runs (OS-level protection) |

## GPO Policy

- Policy name: `MarkdownAllowLocalImages`
- Registry: `HKLM\SOFTWARE\Policies\PowerToys\MarkdownAllowLocalImages`
(DWORD: 1=enabled, 0=disabled)
- ADMX category: **PowerToys > File Explorer Preview**
- Uses `getConfiguredValue()` (individual module setting pattern, no
global utility fallback)

## Screenshots

### Settings UI — new toggle
_"Show local images" toggle nested under the Markdown preview section
(File Explorer add-ons). Captured from a Debug build of this branch (the
Settings app only runs standalone in Debug builds):_

<img width="1904" height="1014" alt="07-settings-ui-toggle"
src="https://raw.githubusercontent.com/st-gr/PowerToys/pr-47857-assets/07-settings-ui-toggle.png"
/>

### Settings UI — locked by GPO
_With the `MarkdownAllowLocalImages` policy set to Disabled, the toggle
is forced Off and grayed out, and the "managed by your organization"
info bar appears:_

<img width="1904" height="1014" alt="08-settings-ui-gpo-locked"
src="https://raw.githubusercontent.com/st-gr/PowerToys/pr-47857-assets/08-settings-ui-gpo-locked.png"
/>

### GPO in Group Policy Editor
_New "File Explorer Preview" category under PowerToys, showing the
policy and its description:_

<img width="1472" height="847" alt="01-gpedit-category"
src="https://github.com/user-attachments/assets/54acb539-345b-4512-9685-35930966a142"
/>

### GPO set to Enabled
_Policy enabled state in gpedit.msc:_

<img width="1473" height="848" alt="02-gpedit-policy-enabled"
src="https://github.com/user-attachments/assets/883f6b22-179d-4311-983d-2d835e4d897a"
/>

### Preview with local images rendered
_Markdown preview with local image rendering enabled — relative path
image renders:_

<img width="1430" height="881" alt="03-preview-images-shown"
src="https://github.com/user-attachments/assets/4a7ac7f0-d57d-4feb-bf2f-7e3c9093ab52"
/>

### Info bar for blocked remote images
_When the document contains remote (http/https) image URLs, they are
always blocked and an info bar is shown:_

<img width="1412" height="1035" alt="04-preview-infobar"
src="https://github.com/user-attachments/assets/0f798bbc-ae1b-43bf-b343-394080fff8e3"
/>

### GPO disabled — all images blocked
_With GPO set to disabled, all images (local and remote) are blocked.
Info bar reads "Some pictures have been blocked...":_

<img width="1417" height="704" alt="05-gpo-disabled-blocked"
src="https://github.com/user-attachments/assets/1c7a09a7-f4b9-467c-a0c0-f670680d6a2d"
/>

### Mark-of-the-Web protection
_Files copied from a network source carry a Zone Identifier (MotW).
Explorer blocks the preview entirely before our code runs — an OS-level
security layer:_

<img width="1114" height="591" alt="06-MotW-tagged"
src="https://github.com/user-attachments/assets/09cc2055-1e12-4c11-81fb-abd83ab8249c"
/>

## Implementation

Two layers were blocking images:
1. **Markdig AST layer** (`HTMLParsingExtension.cs`): replaced image
URLs with `#`
2. **WebView2 layer** (`MarkdownPreviewHandlerControl.cs`): returned
HTTP 403 for all non-HTML requests

Changes:
- `HTMLParsingExtension`: conditionally resolves markdown `![](path)`
images to virtual host URLs with path traversal protection
- `MarkdownHelper`: regex-rewrites relative `src=""` in raw HTML `<img>`
tags to virtual host URLs
- `MarkdownPreviewHandlerControl`: serves `https://localmdimages/`
requests in the `WebResourceRequested` handler — the URL is resolved
back to a file path, re-validated for containment against the allowed
base path (document directory, or share root for UNC), and the bytes are
returned via `CreateWebResourceResponse` with the proper content type.
Note: `SetVirtualHostNameToFolderMapping` is deliberately NOT used for
images — WebView2 Runtime 150+ no longer serves files from UNC/network
folder mappings (verified by A/B test on 150.0.4078.48); serving from
the handler works uniformly for local and UNC paths
- Settings UI: new toggle nested under the Markdown preview expander,
with GPO lock support
- Handler `Settings.cs`: reads `EnableMdLocalImages` via
`SettingsUtils`, GPO override via `GPOWrapper`
- GPO: `gpo.h` individual module setting, ADMX/ADML with
`FileExplorerPreview` category

## Known limitation

Peek also renders Markdown through `FilePreviewCommon.MarkdownHelper`,
but calls it without the
local-images arguments, so **Peek does not show local images even when
the setting is enabled** — it
keeps the existing behavior of blocking every image. With the setting
on, the same file therefore
renders differently in the preview pane (images shown) and in Peek
(images blocked).

This is deliberate for now: wiring the setting through Peek means
changing a module that is otherwise
untouched by this PR. Verified that Peek itself is unaffected — it still
renders Markdown correctly
against the shared assembly, with images blocked as before.

## Test plan
- [x] Toggle OFF: images blocked, "pictures blocked" info bar shows
(existing behavior)
- [x] Toggle ON with relative paths: `![](images/test.png)` renders
- [x] Toggle ON with HTML img: `<img src="images/test.png">` renders
- [x] Toggle ON with path traversal: `![](../../secret.png)` — blocked
- [x] Toggle ON with remote URL: `![](https://...)` — blocked, info bar
shown
- [x] UNC path: preview works on `\\server\share\...\file.md` with
relative images
- [x] UNC path with `../` within share: allowed (resolves within share
root)
- [x] Regression tested on WebView2 Runtime 150.0.4078.48: local + UNC
images render, blocked cases (traversal, data:, remote, encoded
traversal) stay blocked
- [x] GPO Enabled: images forced on
- [x] GPO Disabled: images forced off
- [x] GPO Not Configured: user controls toggle
- [x] gpedit.msc: policy appears under PowerToys > File Explorer Preview
- [x] MotW-tagged files: Explorer blocks preview before our code runs
- [x] Settings UI toggle locked when GPO configured (grayed out for both
forced states)
- [x] Other preview handlers (Monaco, SVG, PDF) unaffected

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-08-13 18:12:04 +02:00
Gordon Lam
39c048d06f [Advanced Paste] Don't hardcode reasoning_effort=minimal for OpenAI p… (#49840)
…roviders

PR #46727 added `ReasoningEffort = "minimal"` to
OpenAIPromptExecutionSettings in
SemanticKernelPasteProvider.CreateExecutionSettings(). The value is not
user-configurable, so every OpenAI/Azure OpenAI request now fails on
models that don't accept 'minimal':

HTTP 400 (invalid_request_error: unsupported_value) Parameter:
reasoning_effort
Unsupported value: 'reasoning_effort' does not support 'minimal' with
this
  model. Supported values are: 'medium'.

This is the same class of regression PR #43766 previously fixed by
removing hardcoded Temperature/tuning properties. Remove the property so
the service default applies, and add a comment to prevent it being
reintroduced.

<!-- 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
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-13 11:24:09 +00:00
Lucas Martins
29471231dd Add FancyZones monitor window rotation (#48772)
# Summary

Adds an opt-in FancyZones feature to rotate processable windows across
connected monitors.

The feature lets users hold the configured monitor rotation hotkey,
preview the current monitor content order, and rotate windows left or
right across monitor work areas using the arrow keys. The overlay keeps
content numbers visually consistent while windows move between monitors.

This change was prototyped and implemented with assistance from Codex.

# Demo

![Monitor window rotation
demo](https://raw.githubusercontent.com/APONTES19/PowerToys/feature/monitor-window-rotation/doc/images/fancyzones/monitor-window-rotation.gif)

# Details

- Adds FancyZones settings for monitor rotation and its activation
hotkey.
- Adds Settings UI controls under FancyZones > Windows.
- Extends the FancyZones keyboard hook to forward keyup events.
- Adds window snapshot, monitor mapping, and work-area-relative rotation
logic.
- Adds a dark visual overlay with monitor-content numbering and
directional transition hints.
- Updates FancyZones settings parsing coverage.

# Validation

- Built `FancyZonesLib.vcxproj` successfully.
- Built `FancyZones.vcxproj` successfully.
- Built Settings UI projects successfully.
- Built Runner successfully.
- Ran focused FancyZones settings parse tests successfully.
- Manual validation performed on a multi-monitor setup.

# Notes

The feature is disabled by default and must be enabled from FancyZones
settings.

---------

Co-authored-by: Muyuan Li (from Dev Box) <muyuanli@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2b3acca3-e49b-4936-8fb9-6f669bd449db
2026-08-13 09:56:33 +08:00
Jiří Polášek
e453781909 CmdPal: Fix dock band activation lifecycle (#49739)
## Summary of the Pull Request

This PR improve handling of the dock band life cycle, with PerfMon
benefiting from this - it should reduce risk of bands being stuck.

- Remembers the exact IListPage used for the ItemsChanged subscription,
so we have muching unsubscribe.
- Serializes initialization and cleanup to prevent late subscriptions.
- Derives Performance Monitor load state from active subscribers, so our
decisions now follow the real-world state.
- Prevents widget activation counts from underflowing during Dock
rebuilds.
- Adds regression tests for activation transitions and cleanup races.
2026-08-12 17:33:56 -05:00
Jiří Polášek
14a966f3ee CmdPal: Add file and list settings controls (#49623)
## Summary of the Pull Request

This PR adds reusable Command Palette extension settings controls for
selecting files and folders and managing lists.

The new controls include:

- `FilePathSetting` for selecting a single file or folder.
- `FilePathListSetting` for managing multiple file and/or folder paths.
- `StringListSetting` for managing plain string values.
- `KeyValueListSetting` for managing key-value pairs.
- Optional regex validation for strings, keys, and values.
- Optional duplicate prevention for strings and key-value keys.
- Configurable file picker filters.
- Custom persisted-string conversion.
- Fallback content when the Command Palette host does not support a
control. But this has no direct impact now, because there's a bug in
WinUI3 AC renderer that throws it away (sad panda).

## Pictures? Picture!

<img width="856" height="974" alt="image"
src="https://github.com/user-attachments/assets/2e5d9ee1-9eca-48a7-803a-76a96859722e"
/>



<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
- [x] Closes: #49622 
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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 PR extends `Microsoft.CommandPalette.Extensions.Toolkit` with
file-path, file-path-list, string-list, and key-value-list settings.

The Command Palette host registers custom Adaptive Card input elements
during application startup. The controls use native file and folder
pickers parented to the window containing the form, so they work
correctly in both the Settings window and palette-hosted forms.

List controls render as constrained, scrollable lists with add and
remove actions. They support developer-configurable validation,
duplicate handling, picker modes, and error messages.

List values crossing the extension/host boundary use a structured codec
that preserves unknown properties and remains compatible with the
previously accepted bare-string representation. Persisted values can use
the default newline representation or developer-provided conversion
callbacks.

The SDK emits Adaptive Card `requires` and fallback information so
extensions built with the new controls can provide actionable content
when loaded by an older Command Palette host.

A Sample Pages extension page demonstrates all new setting types and
their validation options.

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2026-08-12 17:29:49 -05:00
Michael Jolley
888a142724 [CmdPal] Consolidate search ranking changes (#49832)
## What's going on

The stacked pull requests are blocked by GitHub's stack merge flow. This
gives the full remaining search ranking change set one PR against
`main`.

## The plan

- Consolidates the open work from #49190, #49191, #49194, #49195,
#49197, #49246, #49247, and #49249.
- Keeps the existing stack unchanged while this PR provides an alternate
merge path.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5459b847-afeb-4163-a803-977759dd92df
Copilot-Session: 49185697-186e-406f-b081-8c985c134274
Copilot-Session: 92905c83-2de6-449c-b4a1-a08003fe2576
Copilot-Session: efe987e5-9297-47fc-af99-2f49b057285a
Copilot-Session: f42917e2-d298-4bde-9056-79a9e6e17dfa
2026-08-12 11:18:10 -05:00
Christian Gaarden Gaardmark
b605fd35c5 New+ Rename and Desktop icon positioning improvements (#48083)
New+ Rename and Desktop icon positioning improvements. Manually tested
on Windows 11. Windows 10 updates have NOT been tested.

## Summary of the Pull Request
* Obtain cursor position early in the lifecycle of the context menu
* Busy wait until copy is complete and shell is aware of icon
* If context menu is on desktop, reposition the icon using the cursor
position obtained scaled using monitor appropriate DPI
* Slight refactor to help port code from New++ to New+

## PR Checklist
- [x] Closes: #36440
- [ ] **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
- [n/a] **Localization:** All end-user-facing strings can be localized
- [n/a] **Dev docs:** Added/updated
- [n/a] **New binaries:** Added on the required places
- [n/a] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [n/a] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [n/a] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [n/a] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [n/a] **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

## Detailed Description of the Pull Request / Additional comments
* n/a

## Validation Steps Performed

**Windows 11**
* x64: Manually tested
* ARM64: Not tested

**Windows 10**
* Not tested

---------

Co-authored-by: Boliang Zhang (from Dev Box) <bozhang@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 41b6b39b-b620-4e02-b7ca-8ae470a9c1e2
2026-08-12 14:23:48 +08:00
moooyo
c4431304c4 [Quick Accent] Fix missing last-item selection highlight (#49820)
## Summary of the Pull Request

Fixes a pre-existing Quick Accent rendering edge case where the last
character is selected and inserted correctly, but its selection
highlight is missing when a long character list is scrolled to the end.

The horizontal items panel now leaves a symmetric 1-DIP margin outside
its edge containers. This keeps `ScrollIntoView` from landing exactly at
the maximum scroll offset, where WinUI can clip the last item's selected
visual. The symmetric margin preserves short-list centering and works in
both flow directions.

The behavior was reproduced on both the #49633 baseline and #49655, so
it was not introduced by #49655.

## PR Checklist

- [ ] Closes: N/A — discovered while validating #49655; no matching
issue is currently filed
- [ ] **Communication:** Draft PR for maintainer discussion
- [x] **Tests:** Existing tests pass; the XAML compositor edge was also
covered by a deterministic GUI regression run
- [x] **Localization:** N/A — no end-user-facing strings changed
- [x] **Dev docs:** N/A — no developer-facing behavior or contract
changed
- [x] **New binaries:** N/A — no binaries or dependencies added
- [x] **Documentation updated:** N/A — no documentation impact

## Detailed Description of the Pull Request / Additional comments

With the overflowing horizontal list at its maximum offset, the last
`ListViewItem` remains realized, selected, and visible, and its
`SelectionIndicator` has opacity 1. However, WinUI does not paint that
selected visual. Adding one DIP of scroll extent after the edge
container avoids that boundary condition without changing selection or
keyboard-navigation logic.

The panel margin is symmetric so non-overflowing lists remain centered
and RTL layouts receive the same protection at either edge.
Infinite-width measurement already includes the margin, so the existing
window sizing path needs no special case.

## Validation Steps Performed

- Built `PowerAccent.UI` with `Debug|x64` using `tools/build/build.ps1`.
- Built `PowerAccent.Common.UnitTests` and `PowerAccent.Core.UnitTests`
with `Debug|x64`.
- Ran both suites with `vstest.console.exe`: **55/55 passed**.
- Reproduced the original failure by holding `A`, pressing `Space`, then
`Shift+Space` before reveal: the selected `ₐ` was inserted but the
baseline showed no selection-highlight pixels.
- Repeated the same first-frame scenario **20 times** after the fix: all
first and stable frames rendered the highlight (4441 detected accent
pixels), with the foreground window preserved.
- Repeated insertion validation in a dedicated text host **5 times**:
all runs inserted `U+2090` (`ₐ`), rendered the highlight, and preserved
foreground focus.
- Ran `git diff --check` successfully.

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
2026-08-11 07:47:02 +00:00
Clint Rutkas
dbff0e798d [Mouse Highlighter] Keep ripple work off the low-level hook (#49699)
<!-- 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

Mouse Highlighter performed synchronous WinRT Composition work in its
`WH_MOUSE_LL` callback. Slow low-level hook callbacks stall the shared
mouse-hook chain and can be silently removed by Windows, causing a
button-up event to be lost and leaving the ripple or pressed state
stuck. FancyZones was inspected to confirm ownership but is not changed
by this PR.

This moves Mouse Highlighter's visual, animation, timer, and Z-order
work onto its module window thread. The hook now records events in a
bounded, allocation-free FIFO and posts a window message. Adjacent
high-rate mouse moves are coalesced, while button ordering, hook
timestamps, and signed screen coordinates (including negative
multi-monitor coordinates) are preserved. Stop, settings changes, and
teardown clear pending events, pressed state, hold state, and timers.
Settings application is also marshaled to the window thread so WinRT
Composition remains thread-affine.

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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [x] **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
- [x] **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

The low-level hook now does only constant-time event capture and queue
signaling. A fixed-capacity FIFO preserves the sequence of button
transitions and mouse positions without allocating in the hook. Only
adjacent move events are coalesced, avoiding message flooding without
moving a cursor update across a button boundary. Input timestamps keep
quick-click versus hold classification based on the original 180 ms
threshold even if window-thread processing is delayed.

All Composition access runs through the Mouse Highlighter window/message
queue. Lifecycle paths unhook before clearing the queue and reset
button, ripple-hold, spotlight, and timer state. If the bounded queue
ever fills, recovery resets transient visual state before retaining the
triggering button event rather than risking a dropped button-up.

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

- Built
`src/modules/MouseUtils/MouseHighlighter/MouseHighlighter.vcxproj` in
Debug x64.
- Built `src/modules/FancyZones/FancyZonesLib/FancyZonesLib.vcxproj` in
Debug x64 to verify the unchanged hook-chain neighbor.
- Ran `git diff --check`.
- Performed a focused concurrency and event-ordering code review.

No focused native unit-test seam exists for this hook/Composition path
without disproportionate refactoring, so no automated test was added. No
end-to-end rapid-click/drag stress run across mixed-DPI multi-monitor
layouts was performed.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Muyuan Li <116717757+MuyuanMS@users.noreply.github.com>
Copilot-Session: 6caaf738-168e-4b11-8efb-b155139dac31
Copilot-Session: 259addc8-304d-4595-83c8-bba3d76e0637
2026-08-11 14:24:07 +08:00
Makoto Sakaguchi
a60c104d71 FileLocksmith: Fix context menu items are not localized (#49606)
<!-- 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
Fixing the issue where Windows 11 context menu items are not localized.

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

- [x] Closes: #37271 (Localized part ONLY)
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end-user-facing strings can be localized
- [x] **Dev docs:** No documentation changes are required for project
configuration fixes
- [x] **New binaries:** No new binaries are added
- [x] **Documentation updated:** No user documentation changes are
required

<!-- 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
Reorganize resource items for the `FileLocksmithContextMenu` project
 - Mark `resource.base.h` as a non-compiled `None`
 - Add `Generated Files/resource.h` as a `ClInclude`
 - Mark `FileLocksmithContextMenu.base.rc`as a non-compiled `None`
- Add `Generated Files/FileLocksmithContextMenu.rc` as a
`ResourceCompile`

Update the `.vcxproj.filters` accordingly to reflect the new locations
and filters for header and resource files.

<img width="1920" height="1020" alt="before"
src="https://github.com/user-attachments/assets/db8732e5-408c-4ab9-8c42-2f4d3d31e00a"
/>
Before  


<img width="1920" height="1020" alt="after"
src="https://github.com/user-attachments/assets/87d82eaa-4daf-4339-92c5-40bbe45f7170"
/>
After

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2026-08-11 14:00:24 +08:00
moooyo
fe4a86a54d [Quick Accent] Cloak the accent bar instead of hiding it (#49655)
## Summary of the Pull Request

Follow-up to #49633: replace the way the accent bar's first frame is
protected. #49633 fixed the blank/stale first frame (#49489) by masking
it — `Selector.Opacity = 0`, unveil after two
`CompositionTarget.Rendering` ticks, backed by a 150 ms watchdog. This
PR removes the cause instead, using the technique the Command Palette
and Quick Access already ship: **DWM-cloak the overlay instead of hiding
it**, so it never stops rendering and there is no stale frame to put
back on screen.

No user-visible behaviour change is intended beyond removing the fixed
two-render-tick reveal delay; this is a mechanism swap plus the cleanup
it enables.

## PR Checklist

- [x] **Closes:** N/A — #49489 was already closed by #49633; this
replaces that fix's mechanism
- [x] **Communication:** follow-up to a merged PR in the same module, no
new feature surface
- [x] **Tests:** `PowerAccent.Core.UnitTests` 32/32 still pass (the pure
width logic from #49633 is untouched). The current-head CI status is
tracked in the PR checks; the compositor-specific manual measurements
below were captured before the final commit-fence follow-up and are
labeled accordingly
- [x] **Localization:** no new end-user-facing strings
- [x] **Dev docs:** N/A
- [x] **New binaries:** none
- [x] **Documentation updated:** N/A

## Detailed Description of the Pull Request / Additional comments

### Why cloaking

A hidden WinUI 3 window renders nothing. Its composition surface
therefore still holds the frame it was showing when it was hidden, and
`ShowWindow` puts that stale frame back on screen before the rebuilt
accent list has been laid out — that is #49489. Everything downstream of
that follows from "the window does not render while hidden":

* the bar cannot be measured before it is shown (a `Collapsed` subtree
is never measured), hence #49633's measure-twice workaround;
* #49633 deferred reveal using rendering ticks because it did not have a
composition-commit fence;
* this PR calls
`Microsoft.UI.Composition.Compositor.RequestCommitAsync()` after the bar
has been laid out, sized, positioned and scrolled, and only reveals
after that commit completes. This replaces the frame counter and
watchdog with an explicit compositor fence.

A cloaked window is equally invisible to the user but stays
`SW_SHOWNA`-shown, so XAML keeps laying it out and painting it. This is
exactly what `Microsoft.CmdPal.UI\MainWindow.xaml.cs` does, and its
comment names the same symptom:

```csharp
// TRICKY: show our HWND again. This will trick XAML into painting our
// HWND again, so that we avoid the "flicker" caused by a WinUI3 app
// window being first shown
```

`QuickAccess.UI\QuickAccessXAML\MainWindow.xaml.cs` uses the same
pattern, including the "warm up the window while cloaked" prewarm that
this PR also picks up — which is what removes the *first summon of the
process* case that #49633's second measurement existed for.

### What the summon looks like now

`Show()` still raises `Showing`, so the surface leaves `Collapsed` and
the bar lays out — but the window is still cloaked, so nothing reaches
the screen. The bar is then measured **once** (on a templated, laid-out,
non-collapsed subtree), sized, positioned and scrolled to the selection.
The compositor commit is then awaited, and only after it completes does
`Reveal()` uncloak the window. The first visible frame is a finished bar
by construction rather than by timing.

Removed as a result: `RevealTimeoutMs`, `FramesBeforeReveal`,
`_revealTimer`, `_revealGeneration`, `_renderedFrames`,
`_measuredContentWidthDip`, `ArmRevealTimeout`, `CancelPendingReveal`,
`WaitForFirstFrameThenReveal`, `OnRenderingBeforeReveal`, the local
`Reveal`, and the `Selector.Opacity` dance — 87 net lines out of
`MainWindow`. `_showGeneration` stays: a layout callback queued by a
dismissed summon still has to be dropped.

### `TransparentWindow`

The cloak lives in the shared window because `Hide()` owns the
`AppWindow.Hide()` that has to be replaced. It is **opt-in**
(`EnableCloakedHide()`), so Shortcut Guide's overlay and CmdPal's toast
keep hiding exactly as they do today; only Quick Accent enables it.
`Reveal()` is a no-op for them.

Two details worth review attention:

* **Hit-testing.** Cloaking takes a window out of composition but *not*
out of hit-testing, and this HWND sits exactly where the user is typing.
While cloaked the window is therefore made click-through
(`WS_EX_TRANSPARENT`), restored on reveal. Without this, an invisible
accent bar would swallow clicks meant for the app underneath.
* **`SW_HIDE` then `SW_SHOWNA`.** Same order as CmdPal: the hide is what
hands the foreground back to whatever window should own it, and the show
that follows leaves the window "shown" — which is what keeps XAML
painting — while the cloak keeps it off screen. If DWM refuses to cloak,
the HWND remains hidden; a later `Show()` retries instead of exposing an
un-laid-out frame.

### Relationship to #34849 / #41044

Always-on-top is still released on hide, so the dormant overlay is
`WS_EX_TOPMOST=False` exactly as before — verified below. Cloaking is
orthogonal to topmost. The one honest trade-off is that the HWND is now
permanently `WS_VISIBLE` (cloaked), so it keeps participating in
composition while dormant, the same as CmdPal and Quick Access already
do; it stays out of Alt-Tab and the taskbar via a hidden owner plus
`WS_EX_TOOLWINDOW`.

## Validation Steps Performed

> The build/test/live-state results below were recorded at `e372cdf`.
Current head `ea658bb` adds the explicit `RequestCommitAsync` fence
after that validation. Current-head CI is tracked by the PR checks, and
the live window-state/frame-capture checks should be repeated before
merge.

* `build-essentials`, `Common.UI.Controls`, `PowerAccent.UI` and
`PowerAccent.Core.UnitTests` all build clean (Debug|x64), 0 warnings.
* `PowerAccent.Core.UnitTests`: 32/32 pass.
* Live window-state measurement against the built
`PowerToys.PowerAccent.exe` (`DwmGetWindowAttribute(DWMWA_CLOAKED)` +
`IsWindowVisible` + ex-styles), driving a real summon of the
<kbd>R</kbd> bar with **All languages** selected:

  | phase | state |
  |---|---|
| dormant (prewarmed, before any summon) | `visible=True cloaked=1
topmost=False clickThrough=True` |
| summoned | `visible=True cloaked=0 topmost=True clickThrough=False` |
| dismissed | `visible=True cloaked=1 topmost=False clickThrough=True` |

i.e. the window is shown-and-painting the whole time, invisible and
click-through while dormant, and topmost/interactive only while
summoned.
* Screen-captured the summoned bar: all 22 characters for <kbd>R</kbd>
render (including the wide `₹ ៛ ﷼`), leading and trailing padding are
symmetric, nothing is clipped and the selection is on the first cell.

---------

Co-authored-by: Yu Leng <yuleng@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-11 12:06:19 +08:00
Gleb Khmyznikov
e48152c52d [UITests] Add UITest.Next suites (Image Resizer, Peek, File Explorer add‑ons, File Locksmith) + local‑VM tooling and CI test‑signing (#49671)
## Summary

Adds end‑to‑end UI tests on the `Microsoft.PowerToys.UITest.Next`
(winappcli) framework for three
modules, grows the shared `.Next` test framework with the helpers those
suites needed, and adds the
CI plumbing that lets shell‑extension tests exercise the **real**
Windows 11 modern context menu.
Also ships two agent skills that document how to write and run these
tests.

Product runtime behavior is **unchanged** — the only product edits are
test‑observability hooks in Peek
and a unit‑test project exclude.

Closes: https://github.com/microsoft/PowerToys/issues/40660
https://github.com/microsoft/PowerToys/issues/49424
https://github.com/microsoft/PowerToys/issues/40661

## What's added

### New UI test suites
- **Image Resizer** —
`src/modules/imageresizer/tests/ImageResizer.UITests`: context‑menu
enable/disable
tracking, the resize dialog, custom presets, every fit mode, every unit,
filename format, keep‑date,
  shrink‑only, replace‑in‑place, and orientation.
- **Peek** — `src/modules/peek/Peek.UITests.Next`: file‑preview coverage
across image/text/archive/
  markdown types with per‑arch visual baselines.
- **File Explorer add‑ons** —
`src/modules/previewpane/PreviewPane.UITests`: Preview Pane handlers and
  thumbnail providers.

### `UITestAutomation.Next` framework
- New helpers: `ExplorerShell` (Shell selection/view‑mode interop),
`WaitHelper` (structured stable
waits), `WindowControl` (foreground/context‑menu/process control),
`VisualAssert` (image compare),
  `WindowHelper`.
- Updates to `Session`, `UITestBase`, `SettingsConfigHelper`,
`WinappCli`.
- New `UITestAutomation.Next.UnitTests` project covering the new
wait/settings/CLI helpers.

### CI — sign sparse MSIX so the modern menu registers
- **`.pipelines/signSparsePackages.ps1`** — self‑signs each sparse
context‑menu MSIX with a
publisher‑matching test certificate and force‑trusts it (machine
stores), so
`AddPackageByUriAsync` succeeds on otherwise‑unsigned PR builds. Robust
`signtool` discovery with a
  NuGet fallback; test‑only trust that asserts no security.
- Wired into **`.pipelines/v2/templates/job-test-project.yml`** as a
best‑effort step covering the
run‑in‑place, machine‑install, and per‑user‑install locations. Signs
nothing it can't (skips
  already‑signed packages) and never fails the job.

### Product changes (test observability only)
- **Peek `FilePreview.xaml` / `.xaml.cs`** — a named `LoadingIndicator`
and a hidden automation peer
that exposes the current preview state as text, so tests can read load
state deterministically. No
  runtime behavior change.
- **`ImageResizer.UnitTests.csproj`** — exclude the sibling
`ImageResizer.UITests\**` folder from the
  unit‑test compilation.

### Agent skills & docs
- **New `ui-tests-local-vm` skill** — run `.Next` suites in persistent
dockur/windows VMs: setup,
agentic loop, image customization, troubleshooting, the shell‑extension
**signing** reference, plus
  controller/guest scripts and VM templates.
- **Updated `ui-tests-migration` skill** — WinAppDriver/Selenium →
`.Next` porting guidance
(CI stability, Explorer/shell‑extension test design, patterns &
pitfalls).
- **`doc/devdocs/development/ui-tests.md`** — updated for the `.Next`
workflow.

## Testing
- All three suites pass locally and in CI across **x64 Win10**, **x64
Win11**, and **arm64** (machine
  and per‑user install legs).

## Reviewer notes
- No product runtime behavior changes; product edits are limited to the
Peek test hooks above.
- The CI signing step is a **test‑only** trust anchor (self‑signed,
scoped to the agent) and is
best‑effort, so it can only add modern‑menu coverage and never regress
the job.
2026-08-10 19:55:03 +02:00
Bakorlam
110107e74a feat(shortcut-guide): add Claude Desktop manifest (#49245)
## Summary of the Pull Request
Adds a Shortcut Guide manifest for Claude Desktop (Claude.exe), covering
General (quick chat/search, incognito chat, sidebar toggle, keyboard
shortcuts, settings, open-from-anywhere) and In-chat actions (send, new
line, extended thinking toggle, file upload, stop generation), pulled
directly from the app's own in-app "Keyboard shortcuts" panel (Ctrl+/
inside Claude Desktop).

## PR Checklist

- [x] Closes: #49237
- [ ] **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

## Detailed Description of the Pull Request / Additional comments
Note: the "Open Claude from anywhere" global hotkey (Ctrl+Alt+Space) is
included since it's shown live in the app's shortcut panel on Windows,
though I haven't found it documented on support.claude.com as of this
writing — worth flagging in case Anthropic's docs are just behind.

Tests/Localization/Dev docs/New binaries/Documentation: N/A — this is a
data-only YAML manifest addition, no code changes, following the same
shape as the merged Postman manifest (#48461).

## Validation Steps Performed
Tested manually against a live build of Shortcut Guide with Claude
Desktop focused. Confirmed the Claude section renders with both
categories, and recommended shortcuts (Quick chat/search, Open Claude
from anywhere) are pinned at top. Screenshot attached below.

<img width="547" height="913" alt="Claude_Shortcut_Guide"
src="https://github.com/user-attachments/assets/cd4b17ab-058b-4a64-ade9-e34122aa1eab"
/>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7f3671bf-4341-4127-90f2-c8fbd00a1f73
2026-08-10 17:46:04 +08:00
Jiří Polášek
5b7b91c9de CmdPal: Add extension gallery deep links (#49780)
## Summary of the Pull Request


This PR extends the x-cmdpal:// protocol to allow opening the Extension
Gallery and individual Extension Gallery items.

Extension developers can use this to link users directly from their
websites to the gallery, shortening the path to discovering and
installing Command Palette extensions.

- Adds typed x-cmdpal:// URI parsing in CmdPalProtocolActivation.
- Adds gallery and specific-extension deep links.
    - `x-cmdpal://extensions/gallery`
    - `x-cmdpal://extensions/gallery/{extension-id}`
- Opens extension details after the gallery loads.
- Integrate into existing gallery navigation to prevent garbage nav
stack.

Pictures? Pictures!


https://github.com/user-attachments/assets/d4d55b2a-2624-4a93-bdf7-55348b044b76

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

- [x] Closes: #49770
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-09 14:15:20 -05:00
Gordon Lam
68a2a0d57b [Modules] Handle WM_ENDSESSION in run_message_loop daemons (GrabAndMove, AlwaysOnTop, FancyZones) (#48404)
## Summary

Companion PR to #48378 (runner). Fixes the same
`APPLICATION_HANG_QUIESCE_*_PowerToys.exe!run_message_loop` WER bucket
in the other PowerToys daemons whose top-level windows ignored
`WM_ENDSESSION`.

## Root cause (same as #48378)

`run_message_loop` (`src/common/utils/window.h`) calls `GetMessageW`
which only returns `0` on `WM_QUIT`. If a daemon's WndProc lets
`WM_ENDSESSION` fall through to `DefWindowProc`, no `WM_QUIT` is ever
posted on logoff/shutdown, the loop blocks, CSRSS hits the quiesce
timeout (~5s), `TerminateProcess` fires, and Watson logs
`APPLICATION_HANG_QUIESCE`.

## `run_message_loop` callsite audit

8 production callsites. Persistent daemons that own a top-level window
and were affected:

| Module | Status before | Fix here |
|---|---|---|
| `runner` | hang | Fixed in #48378 |
| `GrabAndMove` | hang (tray icon, NIM_DELETE in WM_DESTROY) | 
`main.cpp` |
| `AlwaysOnTop` | hang |  `AlwaysOnTop.cpp` |
| `FancyZones` | hang |  `FancyZones.cpp` |
| `KeyboardManagerEngine` | n/a | No top-level window → OS skips
WM_ENDSESSION and TerminateProcess directly; no hang bucket possible |
| `ZoomIt` | already handled | SysInternals heritage |
| `PowerLauncher` | already handled | Managed `SessionEnding` event |
| `MeasureTool`, `Notifications` | transient/spawned on demand | Not a
shutdown-time daemon |

## Fix pattern

For `AlwaysOnTop` and `FancyZones` (no tray icon to clean up) — minimal:

```cpp
case WM_ENDSESSION:
    if (wparam) PostQuitMessage(0);  // wparam==FALSE => shutdown vetoed
    return 0;
```

For `GrabAndMove` (has `Shell_NotifyIcon` cleanup in `WM_DESTROY` that
must not run on shutdown) — use a `g_session_ending` flag and skip the
tray-icon delete in `WM_DESTROY`, mirroring runner's `tray_icon.cpp`
pattern from #48378.

No shared header: each module's `WM_DESTROY` cleanup is module-specific;
the abstraction would be too thin and would hide the variance in what to
*skip*.

## Why no logging on the shutdown path

Same reasoning as #48378 review feedback — `spdlog::flush_on(info)`
synchronously flushes to disk; emitting log lines from
`WM_ENDSESSION`/`WM_DESTROY` burns the ~5s quiesce budget for no
diagnostic value (Watson already records the bucket on failure).

## Verification

- Built clean (Debug|x64): GrabAndMove.vcxproj, AlwaysOnTop.vcxproj,
FancyZonesLib.vcxproj — all exit 0.
- Runner counterpart fix (#48378) verified end-to-end with real reboot +
WM_ENDSESSION injection; quiesce 1–8 ms. Same OS-level mechanism applies
here.

## Related

- #48378 — runner fix (this PR's companion)
- #48363 — original community fix (over-engineered; this approach is the
minimal correct one)

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-09 21:01:48 +08:00
Gordon Lam
ed7595f3a7 Harden IPC pipe ownership and shutdown lifecycle (#48902)
## Summary of the Pull Request

The two-way named-pipe IPC server (`TwoWayPipeMessageIPC`, shared by the
runner, Settings, and Quick Access host) created every pipe instance
without `FILE_FLAG_FIRST_PIPE_INSTANCE`. If a pipe with the same name
already existed — for example a leftover instance from a previous run or
another process — `CreateNamedPipe` would quietly create an *additional*
instance and share the name instead of owning it.

This makes `start_named_pipe_server` create the **first** instance with
`FILE_FLAG_FIRST_PIPE_INSTANCE`, so `CreateNamedPipe` fails fast on a
name collision and the server is the authoritative owner of its pipe
name.

## PR Checklist

- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end-user-facing strings can be localized
(N/A — no user-facing strings)
- [x] **Dev docs:** Added/updated (N/A)
- [x] **New binaries:** Added on the required places (N/A — no new
binaries)

## Detailed Description of the Pull Request / Additional comments

- The flag is applied **only** to the first instance. Subsequent
instances continue to omit it, so the existing
`PIPE_UNLIMITED_INSTANCES` behavior is fully preserved.
- The change is contained to a single function in
`src/common/interop/two_way_pipe_message_ipc.cpp`. Public signatures and
the `PowerToys.Interop` ABI are unchanged, so the runner, Settings, and
Quick Access host all benefit without any code changes on their side.

## Validation Steps Performed

- The existing `Common.Interop.UnitTests` `TestSend` exercises the
modified first-instance code path (`Start()` →
`start_named_pipe_server`) and continues to pass — a full IPC round-trip
still works.
- Verified the updated `CreateNamedPipe` open-mode logic compiles
cleanly.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 49797c8c-784d-47e6-bc0f-53464eecec4b
2026-08-09 20:56:12 +08:00
Jiří Polášek
9e12b7a8ee CmdPal: Reduce items on default perfmon band (#49674)
<!-- 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 limits the number of items shown in the default Performance
Monitor dock band to prevent an overcrowded Dock experience.

- Limits the primary Performance Monitor dock band to CPU and RAM.
- Adds a new single-item dock band for network speed, showing upload and
download traffic. (The existing single-item Network shows only % usage).
- Updates the default docks to include both the primary Performance
Monitor band (CPU and RAM) and the new Network Speeds (Received / Sent)
band.

This PR intentionally avoids solving the question of what to do with the
original Performance dock band, that should be triaged separately.

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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-08 13:41:42 -05:00
Jiří Polášek
03c571e1fc CmdPal: Aggregate net adapter stats and default adapter selection (#49678)
## Summary of the Pull Request

This PR introduces a new virtual network adapter in performance monitor
that sums up data from all physical adapters. That way users will see
any network usage, and for most of them it might be good enough. For the
rest, this PR adds a new command to set any network adapter as a
default.

- Switches from Performance Counters to raw GetIfTable2.
- Adds a new virtual network adapter "All" and uses it as a default.
- Adds a new command to set an actual default network adapter for the
perfmon.

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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-08 13:40:59 -05:00
Jiří Polášek
9cfba78b60 CmdPal: Clean up removed top-level view models (#49728)
<!-- 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 ensures that manager-owned top-level commands and dock bands
release their extension subscriptions when they leave their collections.
Previously, provider reloads, removals, and enable/disable cycles could
retain discarded view models and their extension object graphs.

- Add an explicit cleanup path to `TopLevelViewModel`.
- Clean up commands and dock bands displaced by provider updates.
- Clean up entries removed during full command reloads.
- Clean up provider entries when a provider is removed or disabled.
- Perform cleanup after releasing collection locks.

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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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: Claude Opus 5 <noreply@anthropic.com>
2026-08-08 13:39:50 -05:00
Jiří Polášek
a18779ec7c CmdPal: Clean up replaced command view models (#49730)
<!-- 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 formalizes ownership of command view models so replacing a
command releases the outgoing owned instance without cleaning up
commands borrowed by synthetic context items. It applies the same
cleanup discipline to parameter commands and partially built parameter
lists.

This is one of the places that let Command Palette hold COM proxies much
longer than it's desirable.

- Track whether a `CommandViewModel` is owned or borrowed.
- Add replacement logic that cleans up outgoing owned commands.
- Add a borrowing path for shared command instances.
- Clean up commands replaced in parameter view models.
- Roll back partially initialized parameter-list updates.
- Add regression tests for replacement and failure paths.

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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-08 13:05:35 -05:00
Jiří Polášek
a0619fe430 CmdPal: Release extension objects after navigation (#49732)
<!-- 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 replaces the bare collection performed after leaving a list page
with a complete collection and finalization cycle. WinRT and COM proxies
are released by their finalizers, so a single `GC.Collect()` can leave
extension-owned objects retained on the finalizer queue.

Correctly offloaded onto background thread shouldn't pose UX issue, and
finalizers are only way to release COM garbage.

For now, I left the call only in the original place:
- Content and Parameter pages shouldn't generate too much garbage, so we
don't have to push for release explicitly.
- I considered cleanup when the CmdPal cloaks, but that would be
redundant to the cleanup after navigation.

Changes:
- Adds a reusable `ExtensionObjectReleaser` class that can push hard
enough on GC to trash COM garbage.
- Schedules cleanup after navigation instead of collecting immediately.
- Runs a collect, finalizer drain, and second collect off the UI thread.
- Debounces navigation bursts into a single cleanup cycle.
- Reschedules requests when another release cycle is already running.

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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-08 13:01:47 -05:00
Copilot
14b09db016 Add Brave Browser keyboard shortcuts manifest for Shortcut Guide (#49615)
Shortcut Guide had no manifest for Brave Browser, so no shortcuts were
displayed when Brave was the active window.

## Summary of the Pull Request

Adds `BraveSoftware.BraveBrowser.en-US.yml` to the Shortcut Guide
manifests directory. Uses `WindowFilter: "brave.exe"` to match the
active process. The index is auto-generated at runtime by enumerating
all `.yml` files, so no code changes are required.

## PR Checklist

- [ ] **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

## Detailed Description of the Pull Request / Additional comments

57 shortcuts across 4 sections, mirroring the Chrome manifest structure
(Brave is Chromium-based) with Brave-specific adjustments:

- **Tabs and windows** — standard tab/window management plus Brave's
unique "New private window with Tor" (`Ctrl+Alt+N`)
- **Brave features** — Brave Shields toggle (`Alt+D`), bookmarks bar,
history, downloads, DevTools, task manager, find bar, clear browsing
data
- **Address bar** — navigation and search shortcuts
- **Web page** — print, save, reload, zoom, bookmarking, page source,
scrolling

## Validation Steps Performed

- YAML parsed and validated programmatically; structure matches the
existing manifest schema
- Confirmed `WindowFilter: "brave.exe"` matches the Brave Browser
executable name
- Confirmed index.yml is generated at runtime from all `.yml` files — no
index update needed

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

- Fixes #49605

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-08-08 19:58:14 +02:00
Jiří Polášek
d96144a506 CmdPal: Prevent crashes when switching main window backdrops on the fly (#49755)
<!-- 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 prevents CmdPal from crashing when switching backdrops and fixes
transparent tint.

- Keeps a single SystemBackdrop attached and root projected targets
until WinUI disconnects them.
- Swaps and dispose controllers, brushes, and compositors on the XAML
thread.
- Restores tint for transparent solid backdrops using a retained
composition brush.
- Coalesces theme updates and retry transient native backdrop handoffs.
- Adds a fallback background if "Ooops" happens.


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

- [x] Closes: #49744
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-08 12:48:24 -05:00
Mike Griese
f2796b74a5 CmdPal: make dialogs prevent compact mode from being collapsed (#49451)
ContentDialogs we present for CommandResult.Confirm need to be visible.
When the window is clipped for compact mode, the dialog is predictably
also collapsed.

This makes sure that content dialogs are always visible, by forcing us
out of compact mode when dialogs are shown.

Closes: quite sure it was filed somewhere, right?
2026-08-08 10:34:53 -05:00
Gleb Khmyznikov
a87f5b07a9 Advanced Paste additional customizations and PhiSilica provider (#46727)
## Summary

Adds an on-device **Phi Silica (Windows AI) paste provider** to Advanced
Paste and richer
per-action customization, plus the **package-identity plumbing** that
lets the unpackaged
Advanced Paste app use Windows AI APIs.

> Note: this supersedes the earlier "self-contained MSIX package
installed/registered by the
> WiX installer" approach. Advanced Paste is **not** packaged or
installed as a standalone
> MSIX. It keeps shipping as the existing unpackaged, self-contained
WinUI 3 executable in
> `WinUI3Apps/` and acquires **package identity at runtime from the
existing PowerToys sparse
> package** — there are no installer or ESRP MSIX repack changes.

## Advanced Paste features

- **New Phi Silica paste provider**
(`CustomActions/PhiSilicaPasteProvider.cs`): an on-device
AI provider backed by the Windows AI Phi Silica language model — no
cloud endpoint or API
key required. Registered as a new `AIServiceType` via
`PasteAIProviderFactory` /
  `AIServiceTypeRegistry`.
- **Additional custom actions** (`AdvancedPasteAdditionalAction`):
user-defined actions with
their own prompt, system prompt, AI provider, and shortcut — plus an
optional "coaching"
prompt/system-prompt/provider/shortcut and shortcut-conflict detection.
- **Built-in default prompts** (`AdvancedPasteDefaultPrompts`) and
updates to
  `AdvancedPasteCustomAction`, `PasteFormat(s)`, `OptionsViewModel`, and
`PasteFormatExecutor` to support per-action provider selection and
system prompts.
- **Settings UI** (`AdvancedPastePage.xaml`/`.xaml.cs`,
`Resources.resw`): configure the
Phi Silica provider, choose a provider per action, edit system/coaching
prompts, and a
Phi Silica availability/readiness experience — Settings queries the
Advanced Paste
executable via `--check-phi-silica`, and a **"Download model"** action
triggers
  `--prepare-phi-silica` to fetch the model and then re-probes.

## Package identity for Windows AI (replaces the MSIX-install approach)

- Phi Silica is a **Limited Access Feature (LAF)** that can only be
unlocked by a process
with a registered **package identity**. Advanced Paste runs unpackaged,
so it obtains
identity from the existing **`Microsoft.PowerToys.SparseApp`** sparse
package
(`src/PackageIdentity/`): a new `<Application
Id="PowerToys.AdvancedPasteUI">` entry in
`AppxManifest.xml` maps it to `PowerToys.AdvancedPaste.exe`, with
matching updates to
  `BuildSparsePackage.ps1`.
- **LAF unlock** at runtime via `PhiSilicaLafHelper.cs`. The
token/attestation are baked at
build time by the `GeneratePhiSilicaLafCredentials` MSBuild target into
`PhiSilicaLafCredentials.g.cs` — local **dev defaults** live in
`src/PhiSilicaLaf.props`
(imported from `Directory.Build.props`) and the **production secret** is
injected via
  `/p:` in the release pipeline.
- New **`AdvancedPaste.dev.manifest` / `AdvancedPaste.prod.manifest`**
application manifests
(selected by `CIBuild`) declaring full-trust and the system AI models
capability.

## Build & pipeline

- **Windows App SDK** moved to the coherent **stable `2.2.0`** line and
**added
`Microsoft.WindowsAppSDK.AI` `2.2.3`** (the Phi Silica APIs). Foundation
`2.1.0` carries the
sparse-identity PRI fix, and the stable AI build matches the OS Windows
AI runtime.
- **Independent versioning** for Advanced Paste
(`src/modules/AdvancedPaste/custom.props`,
XES one-store versioning, `AdvancedPasteVersion`). A
`steps-setup-versioning.yml` step is
added for Advanced Paste in `job-build-project.yml`, ordered **before**
CmdPal to avoid a
  version-collision installer failure (WIX0103).
- `release.yml` passes `PhiSilicaLafToken`/`PhiSilicaLafAttestation`
into the main build;
  spell-check allow-list/patterns updated.
- Removed now-unneeded dependencies: the
`Microsoft.Windows.Compatibility` reference and the
  `Common.UI` "force matching DLL versions" hack.
  
<img width="1073" height="716" alt="image"
src="https://github.com/user-attachments/assets/9364d86a-c0d1-4a08-a669-d98cbcb4b140"
/>
<img width="1038" height="308" alt="image"
src="https://github.com/user-attachments/assets/00eef1dd-b407-4841-bd64-f54f8a145c46"
/>
<img width="194" height="405" alt="image"
src="https://github.com/user-attachments/assets/d2f9c5bb-2507-4112-b3e0-56da681f88ea"
/>
<img width="489" height="453" alt="image"
src="https://github.com/user-attachments/assets/811d1afd-9993-48be-824e-82bb56c5ceca"
/>

[Video clip
internal](https://onedrive.cloud.microsoft/✌️/a@9n6nl3fp/S/cQpvAHrL5M9ZR6eUawztyfyBEgUCwCF-aKg9TbKyyGWP4c0KMA)

[Build
internal](https://microsoft.visualstudio.com/Dart/_build/results?buildId=149920754&view=artifacts&pathAsName=false&type=publishedArtifacts)

---------

Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-08 07:43:59 +02:00
Jiří Polášek
56025d7372 CmdPal: Separate in-flight icon loads from cached results (#49738)
<!-- 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 is stacked on #49737 and separates in-flight icon loading from
completed-result caching. The XAML request path no longer takes a
provider-wide lock, while concurrent requests for the same icon still
share a single task and completion cleanup can retire only that exact
task generation.

The loader now reports whether queue admission succeeded, preventing
requests rejected during shutdown from remaining pending indefinitely.

Overall, it seems that we got rid of a lock and actually reduced
turnaround on UI thread. The separate in-flight tracking takes its tall,
but overall throughput increased (tl;dr - it's faster).

- Deduplicate outstanding icon loads in a dedicated in-flight
dictionary.
- Cache successful tasks before atomically retiring their in-flight
entries.
- Keep failed and rejected loads out of the adaptive cache so they can
be retried.
- Replace `EnqueueLoad` with `TryEnqueueLoad` and fault rejected
requests.
- Add tests for concurrent loading, publication ordering, failures,
rejection, and retries.

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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-07 14:15:34 -05:00
Jiří Polášek
601460561a CmdPal: Avoid all-stripe locking in the adaptive icon cache (#49737)
<!-- 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 removes all-stripe synchronization from `AdaptiveCache`. Using
`ConcurrentDictionary.Count` for capacity checks and `Keys` while
clearing could acquire every dictionary stripe, allowing XAML-bound icon
cache operations to wait behind unrelated concurrent mutations.

**The main problem here is that WinUI doens't take locked main STA
thread well and can fail-fast the app.**

- Track an approximate entry count with atomic updates after successful
mutations.
- Use the approximate count for capacity checks and maintenance
decisions.
- Enumerate the dictionary directly when clearing instead of
snapshotting `Keys`.
- Add concurrent cleanup and count-consistency regression tests.
- Add a matching CmdPal UI unit-test project to the solution.

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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-07 12:40:13 -05:00
Jiří Polášek
3a84795531 CmdPal: Avoid redundant performance widget refreshes (#49735)
<!-- 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 removes a redundant collection refresh from Performance
Monitor's periodically invoked disk metrics callback. The callback
already updates the existing list item titles in place, so raising
`ItemsChanged` on every sample needlessly asks Command Palette to
refresh an unchanged collection.

- Stop raising `ItemsChanged` from the disk page's `Updated` handler.
- Continue updating disk usage and read/write speed titles in place.
- Avoid repeated collection refresh work during periodic performance
sampling.
2026-08-07 12:30:15 -05:00
Jiří Polášek
a5b1ec8124 CmdPal SDK: Fix weak command property subscriptions (#49731)
<!-- 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 a weak-event subscription in the CmdPal toolkit that still
captured its owning `CommandItem` through an instance callback. That
strong reference defeated the weak listener, while command replacement
could also leave a stale handler attached to the outgoing command.

- Make the command property-change callback static.
- Resolve the owning `CommandItem` through the listener's weak
reference.
- Explicitly unsubscribe from the outgoing command during replacement.
- Retain the detach callback that removes dead listeners from long-lived
commands.
2026-08-07 12:28:40 -05:00
Jiří Polášek
d70ab95355 CmdPal: Remove article from "Select a file" button text (#49752)
<!-- 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 changes file picker parameter button text from "Select a file"
to "Select file".

## Pictures? Pictures!

<img width="1600" height="953" alt="image"
src="https://github.com/user-attachments/assets/221eeceb-ac49-4469-8989-b8d01cb4dd2c"
/>


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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-07 15:58:28 +00:00
Niels Laute
57d32bcb6b Fix Keyboard Manager editor file picker not opening when elevated (#48876)
## Summary

Fixes #48845.

In the new WinUI 3 Keyboard Manager editor, clicking the **browse icon**
to select a program path (or "start in" folder) for the *Run Program*
action did nothing — no dialog appeared.

### Root cause

The editor (`PowerToys.KeyboardManagerEditorUI.exe`) is launched by the
Keyboard Manager module DLL via `ShellExecuteExW` from inside the
PowerToys runner (`src/modules/keyboardmanager/dll/dllmain.cpp`). When
PowerToys runs elevated, the editor **inherits that elevation**.

The browse buttons used the legacy **`Windows.Storage.Pickers`**
(`FileOpenPicker` / `FolderPicker` + `InitializeWithWindow`). Those
pickers activate through the UWP runtime broker, which fails with
`E_ACCESSDENIED` in an elevated process. The handlers were `async void`
with no `try/catch`, so the exception was swallowed and no dialog ever
opened. Typing/pasting a path into the field still worked — matching the
bug report.

### Fix

Switch both handlers to the Windows App SDK
**`Microsoft.Windows.Storage.Pickers`** API, constructed with a
`WindowId`. Those pickers are a thin wrapper over the in-process Win32
Common Item Dialog (`IFileOpenDialog`, `CLSCTX_INPROC_SERVER`) and work
correctly in elevated processes — the same mechanism already used
elsewhere in PowerToys (e.g. Settings UI
`IFileDialog`/`GetOpenFileName`, and CmdPal which already uses this
exact namespace). Also wrapped the handlers in `try/catch` with
`Logger.LogError` so any future failure is logged instead of silently
swallowed.

### Verification

- Built `KeyboardManagerEditorUI.csproj` (Release / x64) with all native
dependencies — exit code 0.
- Confirmed against the Windows App SDK source that
`Microsoft.Windows.Storage.Pickers.FileOpenPicker` uses
`create_instance<IFileOpenDialog>(CLSID_FileOpenDialog,
CLSCTX_INPROC_SERVER)` and `dialog->Show(hwnd)`, i.e. the elevation-safe
in-process dialog.

### Notes / out of scope

The report also mentions some apps (e.g. `visio.exe`) not launching
while others (`winword.exe`) do. That's a separate issue in the launch
path (`run_non_elevated` uses `CreateProcessW`, which ignores registry
App Paths / shell activation, unlike `ShellExecute` used by the *Open
URI* action) and is **not** addressed here.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Copilot-Session: 1f00def4-e790-4071-96c6-a81c9c2adba5
2026-08-07 17:05:47 +02:00
Jiří Polášek
9f2ddf6e85 CmdPal: Set Settings window titlebar PreferredTheme to UseDefaultAppMode (#49750)
## Summary of the Pull Request

This PR should fix the incorrect foreground color of title bar glyphs
after a theme change by setting the Settings window's title bar
`PreferredTheme` to [`TitleBarTheme.UseDefaultAppMode`](https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.windowing.titlebartheme?view=windows-app-sdk-2.0).
2026-08-07 09:57:35 -05:00
Jiří Polášek
81d3bb8e34 CmdPal: Initialize page icons after property changes in PageViewModel (#49672)
## Summary of the Pull Request

This PR is a quick fix for pages that changes their icon at runtime, and
then the icon is nowhere to be seen.

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

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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
2026-08-07 09:53:08 -05:00
Michael Clayton
e0010c5642 Ready for Review - [Mouse Jump] - port upstream WinUI3 code to Mouse Jump (microsoft#48290) (#48393)
<!-- 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

Changes for #48290 to convert Mouse Jump to a WinUI app and remove all
remaining dependencies on WinForms, based on work already done in the
original "FancyMouse" project
(https://github.com/mikeclayton/FancyMouse).

## Notes for reviewers

* the new WinUI build of the app is output into the "/WinUI3Apps"
subfolder

* there's 2 new assemblies that need to be added to the installation as
well - MouseJump.HotKeys.dll and MouseJump.Models.dll. I'm not sure how
to add those to the installer for signing / shipping...

---

### Summary of changes

* New thumbnail layout and rendering code
* WinUI rewrite (winforms version still committed)
* MouseJump.Kicker (dev launch tool)
* CsWin32 for interop
* New assemblies - code reorganised

---

### 1. New layout code

Incorporates latest FancyMouse core layout and rendering logic into
Mouse Jump:

* includes **support** for multiple devices in layout algorithms
* preview still only shows local machine though
* prerequisite for long-term goal #34126

<img width="650" height="709" alt="image"
src="https://github.com/user-attachments/assets/9d1d996d-ed05-4471-b8a5-bd93442f70dc"
/>

### 2. WinUI rewrite

Port latest stable FancyMouse WinUI implementation into Mouse Jump.

Existing WinForms UI left in-situ side-by-side for now - easy to delete
if not needed.

### 3. MouseJump.Kicker

A small dev utility to start Mouse Jump without needing to build the
runner project:

<img width="283" height="274" alt="image"
src="https://github.com/user-attachments/assets/c81bb3f5-5008-48ce-8bc0-eef18413dee6"
/>

### 4. Cswin32 for interop

All win32 interop is now accessed via CsWin32 bindings.

The original win32 bindings were heavily influenced by CsWin32 generated
code (e.g. ```BOOL```, ```HWND```, etc structs), so there's not actually
much change other than deleting a lot of boilerplate code.

### 5. New assemblies

Some code has been reorganised into new assemblies to make it easier to
keep Mouse Jump in sync with upstream FancyMouse

* MouseJump.HotKeys
* MouseJump.Models




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

- [x] Closes #48290
- [x] **Communication:** I've discussed this with core contributors
already. If work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end user facing strings can be localized
  -  all ui strings come from Resources.resw
- [x] **Dev docs:** Added/updated
  -  no changes required
- [x] **New binaries:** Added on the required places
  -  no changes required
- [x] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [x] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [x] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [x] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [x] **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
  -  no changes required
<!-- 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

- **Workflow tests**
  - [x] Automated tests passing locally
  - [x] Minimal actions workflow (spelling check) passing for PR
  - [ ] Full actions workflow (msbuild) passing for PR
- **UI tests**
  - [x] Happy path
    - [x] preview image appears when activated
- [x] clicking the preview image moves the mouse cursor to the correct
location
- [x] right-click dismisses the preview image without moving the mouse
- [x] pressing escape dismisses the preview image without moving the
mouse
- [x] left or right clicking another application / desktop dismisses the
preview image without moving the mouse
- [x] Works on multiple monitors with different dpi scaling settings
(e.g. 100% vs 150%)
*
https://github.com/microsoft/PowerToys/pull/23566#issuecomment-1411869418
*
https://github.com/microsoft/PowerToys/pull/23566#issuecomment-1412834413
- [x] Handling negative coordinates on non-primary monitors if higher or
"lefter" than primary monitor
*
https://github.com/microsoft/PowerToys/pull/23566#issuecomment-1404931694
- [x] Mouse crosshair moves when Mouse Jump moves the cursor (mouse
clicks *and* keyboard shortcuts)
    * #24523
    * #24527
- [x] Activating when the preview window is already visible moves the
form to the new mouse position
- [x] Number and key shortcuts (1-9, Home / End, Left / Right Arrow)
jump to the appropriate monitor
  - [x] Number-pad shortcuts (1-9 jump to the appropriate monitor
- **Settings tests**
- [x] Changing thumbnail size settings updates the size of the thumbnail
- [x] Changing preview type between Compact, Bezelled and Custom shows
the correct preview type
  - [x] Changing custom preview settings shows the correct settings
- [ ] Launching with settings version 1.0 upgrades settings to version
1.1, with "Bezelled" as the default style and the "Custom" settings
preconfigured to match "Bezelled"
- **Lifecycle tests**
- [x] Starting PowerToys Runner launches MouseJump exe when enabled, and
not when disabled
- [x] Enabling / disabling Mouse Jump in settings starts / stops
MouseJump exe
  - [x] Exiting PowerToys Runner stops MouseJump exe
  - [x] Killing runner exe via Task Manager stops MouseJump exe
  - [x] Stopping Visual Studio local debug run stops MouseJump exe
- note - runner needs to be in *non*-admin mode otherwise Visual Studio
debugger disconnects at launch
- [x] Hotkey and size settings are automatically reloaded when config
file is modified from Settings UI
- [ ] ~~Hotkey and size settings are automatically reloaded when config
file is modified manually (e.g. in notepad) while runner and
MouseJumpUI.exe are running~~
- **[Internal Test
Suite](5bc7201ae2/doc/releases/tests-checklist-template.md (mouse-utils))**
  - [x] Enable Mouse Jump. Then:
- [x] Press the activation shortcut and verify the screens preview
appears.
- [x] Change activation shortcut and verify that new shortcut triggers
Mouse Jump.
- [x] Click around the screen preview and ensure that mouse cursor
jumped to clicked location.
- [x] Reorder screens in Display settings and confirm that Mouse Jump
reflects the change and still works correctly.
- [x] Change scaling of screens and confirm that Mouse Jump still works
correctly.
- [ ] Unplug additional monitors and confirm that Mouse Jump still works
correctly.
- [x] Disable Mouse Jump and verify that the module is not activated
when you press the activation shortcut.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Boliang Zhang (from Dev Box) <bozhang@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: moooyo <42196638+moooyo@users.noreply.github.com>
Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
Copilot-Session: 8e04a72e-3b0f-4ac4-8156-d04ea9b8bb85
2026-08-07 13:34:15 +08:00
Clint Rutkas
9fcb8faac5 [Quick Accent] Isolate press-and-hold activation (#49701)
## Summary of the Pull Request

Makes the **Press and hold the letter** activation method exclusive.
Pressing a legacy trigger key (Space or either arrow) before the hold
threshold now cancels that owner-letter gesture and passes the trigger
through normally, instead of allowing the already-scheduled picker to
appear later. Typing any different supported physical letter during the
gesture also cancels it, preventing that intervening character from
being replaced when the owner letter is released.

Space and arrow navigation remains available after a genuine hold
activation reaches its threshold.

## PR Checklist

- [ ] Closes: N/A
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [x] **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: N/A

## Detailed Description of the Pull Request / Additional comments

The native keyboard listener previously armed press-and-hold on
owner-letter key-down and immediately queued a delayed managed render.
Although pre-threshold Space/arrows were excluded from native
trigger-key activation, they did not invalidate that pending render.
Holding the owner letter after pressing Space therefore still displayed
the picker and made both invocation systems feel enabled.

This change adds an explicit native-to-managed cancellation event and a
generation-based managed display state:

- In `PressAndHold`, Space or either arrow before the snapshotted hold
threshold cancels the current gesture and passes through without input
injection.
- Space/arrows at or after the threshold retain their intended picker
navigation behavior.
- Any different physical letter in Quick Accent's supported key set
cancels the owner gesture before passing through, even when that letter
has no mapping in the selected language.
- Owner repeats and owner key-up are handled from active physical
ownership rather than current language eligibility, so live language
changes cannot leave stale state.
- Activation mode, input time, and hold duration are atomically
published and snapshotted once per owner gesture. The native listener
passes the same delay snapshot to managed scheduling, so live settings
changes apply to the next gesture instead of desynchronizing native
interaction from picker visibility.
- Character data is prepared before native navigation can become
interactive, preventing accepted navigation from being dropped.
- Legacy Space/arrow/Both acquisition behavior is preserved.

The low-level hook has no clean deterministic native unit-test seam
because its private handlers depend on Win32 keyboard state. Managed
regression coverage exercises delayed-display cancellation, re-arming,
generation invalidation, and delay snapshot preservation.

## Validation Steps Performed

- Built `src/modules/poweraccent/PowerAccent.UI/PowerAccent.UI.csproj`
in `Debug|x64`, covering the native WinRT projection and managed
Core/UI.
- Built
`src/modules/poweraccent/PowerAccentKeyboardService/PowerAccentKeyboardService.vcxproj`
in `Debug|x64`.
- Built and ran all `PowerAccent.Core.UnitTests`: **35 passed, 0
failed**.
- Ran `git diff --check`.
- Performed focused code reviews of pre-threshold trigger cancellation,
intervening mapped/unmapped letters, live mode/duration snapshots,
language changes, owner key-up balance, and post-threshold navigation.

---------

Copilot-Session: cbd8418a-64cb-4c6c-8653-2f3f0a6ceb9e
2026-08-06 21:14:08 -07:00