Compare commits

..

19 Commits

Author SHA1 Message Date
Leilei Zhang
3e6c81f955 update readme and fix spell check 2025-09-02 17:58:10 +08:00
Niels Laute
67a15d2b1b Update README.md 2025-09-02 10:51:32 +02:00
Leilei Zhang
77265b9df6 update highlithts 2025-08-29 19:47:18 +08:00
Leilei Zhang
693a131036 refine sentence 2025-08-28 22:23:57 +08:00
Leilei Zhang
fc87f03fd5 remove next item 2025-08-28 18:17:59 +08:00
Leilei Zhang
9850a19aac fix spelling check 2025-08-28 16:55:03 +08:00
Leilei Zhang
9c3df634b4 update readme 2025-08-28 16:40:54 +08:00
Leilei Zhang
13731e8af1 update README.md 2025-08-28 16:26:38 +08:00
Kai Tao
ef6f4b2c3d Settings: Search fancy zone settings and swallow the ctrl+f event (#41437)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This pull request primarily improves the maintainability and robustness
of the FancyZones settings UI by assigning unique `Name` attributes to
`SettingsCard` controls in the `FancyZonesPage.xaml` file. Additionally,
it enhances the logic for retrieving element UIDs and improves fallback
behavior for missing localizations. There is also a minor usability fix
in the shell page to prevent unintended navigation when focusing the
search box.

**FancyZones settings UI improvements:**

* Added unique `Name` attributes to all `tkcontrols:SettingsCard`
elements in `FancyZonesPage.xaml` to facilitate easier referencing and
future maintainability. This affects all relevant settings groups and
controls in the file.
[[1]](diffhunk://#diff-93623d4db1d295dde0ef793053c9db0d9f673d753b787ad12fd71b8e9e40a79fL73-R85)
[[2]](diffhunk://#diff-93623d4db1d295dde0ef793053c9db0d9f673d753b787ad12fd71b8e9e40a79fL109-R109)
[[3]](diffhunk://#diff-93623d4db1d295dde0ef793053c9db0d9f673d753b787ad12fd71b8e9e40a79fL121-R121)
[[4]](diffhunk://#diff-93623d4db1d295dde0ef793053c9db0d9f673d753b787ad12fd71b8e9e40a79fL167-R188)
[[5]](diffhunk://#diff-93623d4db1d295dde0ef793053c9db0d9f673d753b787ad12fd71b8e9e40a79fL202-R202)
[[6]](diffhunk://#diff-93623d4db1d295dde0ef793053c9db0d9f673d753b787ad12fd71b8e9e40a79fL251-R251)
[[7]](diffhunk://#diff-93623d4db1d295dde0ef793053c9db0d9f673d753b787ad12fd71b8e9e40a79fL265-R265)
[[8]](diffhunk://#diff-93623d4db1d295dde0ef793053c9db0d9f673d753b787ad12fd71b8e9e40a79fL280-R280)

**Element UID retrieval and localization:**

* Improved `GetElementUid` in `Program.cs` to fall back to the first
child's `x:Uid` if the element itself lacks one, increasing robustness
when parsing XAML.
* Updated `GetLocalizedSettingHeaderAndD` in `SearchIndexService.cs` to
provide a fallback for missing localizations by trying the
`"{elementUid}/Content"` resource key.

**Shell page usability:**

* Modified `CtrlF_Invoked` in `ShellPage.xaml.cs` to mark the event as
handled, preventing unintended navigation when the search box is focused
with Ctrl+F.
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **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


https://github.com/user-attachments/assets/9cf15605-1114-4c6d-923c-d05c2733a274
2025-08-28 11:18:58 +08:00
Michael Jolley
336cdaff9b CmdPal: Added settings for limiting apps on top level searches (#40915)
Closes #40062

Adds a setting to limit the number of apps returned on top level
searches.

Can limit to none, 1, 5, 10, or 20.


https://github.com/user-attachments/assets/de60111f-fb02-4db6-9ae9-2f636c171b5b
2025-08-27 10:52:39 -05:00
leileizhang
447118ab70 fix: Context menu registry entries are not cleaned up when disabled via GPO (#41411)
<!-- 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 an issue where context menu runtime registration wasn't
properly cleaned up when GPO (Group Policy Object) policies disabled the
module. The problem occurred because the module constructor didn't
consider GPO policies when determining its initial enabled state.

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

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

This pull request refactors how context menu registration and
unregistration are handled across several PowerToys modules. The main
improvement is the introduction of a new `UpdateRegistration` helper
method in each module, which centralizes and simplifies the logic for
registering or unregistering context menus when the module is enabled or
disabled. This reduces code duplication and ensures consistent behavior.

**Context menu registration logic refactor:**

* Added a private `UpdateRegistration` method to each of the following
modules to handle context menu registration and unregistration based on
the enabled state:
  - `FileLocksmithModule` in `PowerToysModule.cpp`
  - `NewModule` in `powertoys_module.cpp`
  - `ImageResizerModule` in `dllmain.cpp`
  - `PowerRenameModule` in `dllmain.cpp`

* Replaced direct calls to registration/unregistration functions in
`enable`, `disable`, and `init_settings` methods with calls to the new
`UpdateRegistration` method in all affected modules, ensuring consistent
and centralized handling
[[1]](diffhunk://#diff-256ed936dafec1bf6ff17849b4797dd276f5b07bebe2e483bc1580c8f06e92d9L91-R122)
[[2]](diffhunk://#diff-256ed936dafec1bf6ff17849b4797dd276f5b07bebe2e483bc1580c8f06e92d9R155)
[[3]](diffhunk://#diff-4a3942d548f3daec02a833983ed9b2b69f75e2cd1b74a8ce1b874f3fd33fde55L101-R125)
[[4]](diffhunk://#diff-4a3942d548f3daec02a833983ed9b2b69f75e2cd1b74a8ce1b874f3fd33fde55L153-R177)
[[5]](diffhunk://#diff-0c0a89e812ff4625d165417da14f1c3f203e5ac7907555ae4fde122f3dddcf7aL115-L130)
[[6]](diffhunk://#diff-34581ec47c37b0d2e1d9b59696225c47342930694e732db06cbdf653ceb2c2d7L205-R234)
[[7]](diffhunk://#diff-34581ec47c37b0d2e1d9b59696225c47342930694e732db06cbdf653ceb2c2d7R334).

These changes improve maintainability and reduce the risk of
inconsistent registration behavior across modules.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-27 19:16:55 +08:00
Kai Tao
7455d63bb5 Settings: Settings search fixes (#41381)
<!-- 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
Fix 3 issues

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

- [x] Closes: #41369, #41374, #41380
- [ ] **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


https://github.com/user-attachments/assets/0e0df9fb-5aca-4b26-9d53-e6ddc49cab04

---------

Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Jiří Polášek <me@jiripolasek.com>
2025-08-27 14:51:36 +08:00
Niels Laute
bb6b36af3f Search UX improvements (#41386)
### Fixing visual glitch in the 'Show all results' template:

Before
<img width="588" height="103" alt="image"
src="https://github.com/user-attachments/assets/00da60ea-d0ab-4ffe-8f69-75be7e537d63"
/>

After
<img width="598" height="70" alt="image"
src="https://github.com/user-attachments/assets/dc859731-8783-494a-b561-ea6396ca69b3"
/>


### Displaying "Show results for * search term *" on search results page
Before
<img width="716" height="239" alt="image"
src="https://github.com/user-attachments/assets/a80e6e58-df88-47b2-85ab-c39cbdc88690"
/>

After
<img width="349" height="264" alt="image"
src="https://github.com/user-attachments/assets/99029ee6-94f7-4454-a443-640c22f9e6f3"
/>


### Using Accent Color for the search highlight for better visibility
and fixing a bug
Before

![highlight-bug](https://github.com/user-attachments/assets/2d4c0f5b-4030-4c10-a4ec-c7c5023034f0)


After


![fix-accent](https://github.com/user-attachments/assets/62a223a9-9360-4297-9127-5aaef82c162f)

---------

Co-authored-by: vanzue <vanzue@outlook.com>
2025-08-27 13:42:30 +08:00
Jiří Polášek
3ebf0f741a Settings UI: Fix spelling error and make spell checker happy (#41403)
## Summary of the Pull Request

- Renames `NavigatablePage` to `NavigablePage` to fix a spelling error.
- Reverts related entries in `exclude.txt` that triggered a forbidden
pattern error in the spell checker.
- The spell checker does not allow PascalCase words like
`NavigatablePage` in `exclude.txt` because of its automatic casing
rules.

 
Regression: #41285

---------

Co-authored-by: vanzue <vanzue@outlook.com>
2025-08-27 11:29:14 +08:00
Shawn Yuan
e8e1431e15 Fix localization issue for shortcut conflict window (#41378)
<!-- 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
Added localization for conflict message shown in shortcut conflict
window and shortcut dialog.

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

- [x] Closes: #41373 
- [ ] **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
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

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

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

Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
2025-08-27 09:55:43 +08:00
Niels Laute
2d35fd8530 [Fix] Adding Toolkit's TitleBar manually (#41383)
Temp fix for a VS bug when building the `PowerToys.Settings` project. 

There seems to be something wrong with the Labs TitleBar package, so
following up with the team to get it resolved. Meanwhile, I've moved the
Toolkit's source code for TitleBar to Settings as a custom control.

Once the package is fixed we can revert this change.
2025-08-27 09:27:11 +08:00
Michael Jolley
13d950a40a Adding sort to DateTime extension results (#41389)
Closes #41385

Adds a sort to the DateTime extension results.

<img width="1001" height="602" alt="image"
src="https://github.com/user-attachments/assets/ccccae6a-c4a4-460f-a6d3-3325ecfc53da"
/>

<img width="992" height="606" alt="image"
src="https://github.com/user-attachments/assets/b8af51bd-cbd0-4341-ac46-0fb3e97ec2ac"
/>
2025-08-26 15:34:06 -05:00
Jiří Polášek
3eb8f96f3e CmdPal: Fix resource key name NavigationPaneClosed to match literal in code and prevent crash (#41361)
## Summary of the Pull Request

Corrects a mismatch between the resource key and the actual literal used
in code. The key was incorrectly named `NavigationPageOpened`; it now
correctly uses `NavigationPaneClosed`. Introduced in #41016.


## PR Checklist

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

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

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-08-26 14:30:13 -05:00
Mike Griese
11218ea4d8 CmdPal: Make debugging extension load errors easier (#41251)
Turns out we didn't log all the HRESULTs for failing to load an
extension. This adds more logging.

It also adds a context command on the log command to make it easier to
get to the log files
2025-08-26 10:54:58 -05:00
100 changed files with 2015 additions and 570 deletions

View File

@@ -49,6 +49,7 @@ ALPHATYPE
AModifier
amr
ANDSCANS
animatedvisuals
Animnate
ANull
AOC
@@ -1024,8 +1025,6 @@ MYICON
NAMECHANGE
namespaceanddescendants
nao
Navigatable
NavigatablePage
NCACTIVATE
ncc
NCCALCSIZE
@@ -1316,6 +1315,7 @@ PRODUCTVERSION
Progman
programdata
projectname
projitems
PROPERTYKEY
Propset
PROPVARIANT
@@ -1395,6 +1395,7 @@ regkey
regroot
regsvr
REINSTALLMODE
releaseblog
reloadable
Relogger
remappings

View File

@@ -260,3 +260,7 @@ Process Process
# ZoomIt menu items with accelerator keys
E&xit
St&yle
# This matches a relative clause where the relative pronoun "that" is omitted.
# Example: "Gets or sets the window the TitleBar should configure."
\bthe\s+\w+\s+the\b

View File

@@ -23,7 +23,6 @@
<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" />
<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls.Markdown" Version="7.1.2" />
<PackageVersion Include="CommunityToolkit.Labs.WinUI.Controls.MarkdownTextBlock" Version="0.1.250703-build.2173" />
<PackageVersion Include="CommunityToolkit.Labs.WinUI.TitleBar" Version="0.0.1-build.2206" />
<PackageVersion Include="ControlzEx" Version="6.0.0" />
<PackageVersion Include="HelixToolkit" Version="2.24.0" />
<PackageVersion Include="HelixToolkit.Core.Wpf" Version="2.24.0" />

View File

@@ -1499,7 +1499,6 @@ SOFTWARE.
- CoenM.ImageSharp.ImageHash
- CommunityToolkit.Common
- CommunityToolkit.Labs.WinUI.Controls.MarkdownTextBlock
- CommunityToolkit.Labs.WinUI.TitleBar
- CommunityToolkit.Mvvm
- CommunityToolkit.WinUI.Animations
- CommunityToolkit.WinUI.Collections

199
README.md
View File

@@ -35,19 +35,19 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
Go to the [Microsoft PowerToys GitHub releases page][github-release-link] and click on `Assets` at the bottom to show the files available in the release. Please use the appropriate PowerToys installer that matches your machine's architecture and install scope. For most, it is `x64` and per-user.
<!-- items that need to be updated release to release -->
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.94%22
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.93%22
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.93.0/PowerToysUserSetup-0.93.0-x64.exe
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.93.0/PowerToysUserSetup-0.93.0-arm64.exe
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.93.0/PowerToysSetup-0.93.0-x64.exe
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.93.0/PowerToysSetup-0.93.0-arm64.exe
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.95%22
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.94%22
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.94.0/PowerToysUserSetup-0.94.0-x64.exe
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.94.0/PowerToysUserSetup-0.94.0-arm64.exe
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.94.0/PowerToysSetup-0.94.0-x64.exe
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.94.0/PowerToysSetup-0.94.0-arm64.exe
| Description | Filename |
|----------------|----------|
| Per user - x64 | [PowerToysUserSetup-0.93.0-x64.exe][ptUserX64] |
| Per user - ARM64 | [PowerToysUserSetup-0.93.0-arm64.exe][ptUserArm64] |
| Machine wide - x64 | [PowerToysSetup-0.93.0-x64.exe][ptMachineX64] |
| Machine wide - ARM64 | [PowerToysSetup-0.93.0-arm64.exe][ptMachineArm64] |
| Per user - x64 | [PowerToysUserSetup-0.94.0-x64.exe][ptUserX64] |
| Per user - ARM64 | [PowerToysUserSetup-0.94.0-arm64.exe][ptUserArm64] |
| Machine wide - x64 | [PowerToysSetup-0.94.0-x64.exe][ptMachineX64] |
| Machine wide - ARM64 | [PowerToysSetup-0.94.0-arm64.exe][ptMachineArm64] |
This is our preferred method.
@@ -93,118 +93,145 @@ For guidance on developing for PowerToys, please read the [developer docs](./doc
Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on.
### 0.93 - Aug 2025 Update
### 0.94 - Sep 2025 Update
In this release, we focused on new features, stability, optimization improvements, and automation.
For an in-depth look at the latest changes, visit the [release blog](https://aka.ms/powertoys-releaseblog).
**✨Highlights**
- PowerToys settings debuts a modern, card-based dashboard with clearer descriptions and faster navigation for a streamlined user experience.
- Command Palette had over 99 issues resolved, including bringing back Clipboard History, adding context menu shortcuts, pinning favorite apps, and supporting history in Run.
- Command Palette reduced its startup memory usage by ~15%, load time by ~40%, built-in extensions loading time by ~70%, and installation size by ~55%—all due to using the full Ahead-of-Time (AOT) compilation mode in Windows App SDK.
- Peek now supports instant previews and embedded thumbnails for Binary G-code (.bgcode) 3D printing files, making it easy to inspect models at a glance. Thanks [@pedrolamas](https://github.com/pedrolamas)!
- Mouse Utilities introduces a new spotlight highlighting mode that dims the screen and draws attention to your cursor, perfect for presentations.
- Test coverage improvements for multiple PowerToys modules including Command Palette, Advanced Paste, Peek, Text Extractor, and PowerRename — ensuring better reliability and quality, with over 600 new unit tests (mostly for Command Palette) and doubled UI automation coverage.
- PowerToys Settings added a Settings search with fuzzy matching, suggestions, a results page, and UX polish to make finding options faster.
- A comprehensive hotkey conflict detection system was introduced in Settings to surface and help resolve conflicting shortcuts. Note that the default hotkey settings (Win+Ctrl+Shift+T, Win+Ctrl+V, Win+Ctrl+T, Win+Shift+T) may overlap with existing Windows system shortcuts. This is expected. You can resolve the conflict by assigning different hotkeys.
- Mouse Utilities added a “Gliding cursor” accessibility feature to Mouse Pointer Crosshairs for singlebutton cursor movement and clicking. Thanks [@mikehall-ms](https://github.com/mikehall-ms)!
- The installer was upgraded to WiX 5 after WiX 3 reached end-of-life; this move improved installer security, reliability, and community support.
- Tons of bug fixes and improvements for Command Palette, including visual updates and new support for filters on ListPages (handy for extension developers).
- Hosts Editor now has a “No leading spaces” option so active host entries can start at column 0 even if others are disabled. Thanks [@mohammed-saalim](https://github.com/mohammed-saalim)!
- Context menu registration was moved from the installer to runtime to avoid loading disabled modules (runtime registrations).
- Quick Accent now supports Maltese, and frequently used accents appear first (and are remembered across sessions). Thanks [@rovercoder](https://github.com/rovercoder)! [@davidegiacometti](https://github.com/davidegiacometti)!
### Always On Top
- Fixed the border hover cursor so it shows the arrow instead of the wait cursor. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
### Command Palette
- Ensured screen readers are notified when the selected item in the list changes for better accessibility.
- Fixed command title changes not being properly notified to screen readers. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Made icon controls excluded from keyboard navigation by default for better accessibility. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Improved UI design with better text sizing and alignment.
- Fixed keyboard shortcuts to work better in text boxes and context menus.
- Added right-click context menus with critical command styling and separators.
- Improved various context menu issues, improving item selection, handling of long titles, search bar text scaling, initial item behavior, and primary button functionality.
- Fixed context menu crashes with better type handling.
- Fixed "Reload" command to work with both uppercase and lowercase letters.
- Added mouse back button support for easier navigation. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Fixed Alt+Left Arrow navigation not working when search box contains text. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Updated back button tooltip to show keyboard shortcut information. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Fixed Command Palette window not appearing properly when activated. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Fixed Command Palette window staying hidden from taskbar after File Explorer restarts. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Fixed window focus not returning to previous app properly.
- Fixed Command Palette window to always appear on top when shown and move to bottom when hidden. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Fixed window hiding to properly work on UI thread. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Fixed crashes and improved stability with better synchronization of Command list updates. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Improved extension disposal with better error handling to prevent crashes. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Improved stability by fixing a UI threading issue when loading more results, preventing possible crashes and ensuring the loading state resets if loading fails. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Enhanced icon loading stability with better exception handling. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Added thread safety to recent commands to prevent crashes. Thanks [@MaoShengelia](https://github.com/MaoShengelia)!
- Fixed acrylic (frosted glass) system backdrop display issues by ensuring proper UI thread handling. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Applied single-click activation only to pointer input; keyboard always activates immediately. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Let context menus open at the cursor by removing window-bound constraints. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Made error messages clearer with timestamps, HRESULTs, and full details for easier diagnosis. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Prevented crashes and improved robustness when updating providers without commands. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Ensured the Settings window reliably comes to the front when opened. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Replaced the Clipboard History icon with a colorful Fluent icon. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Hardened ContentIcon to avoid duplicate parenting and improve diagnostics. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Standardized null checks using C# pattern matching for safer behavior.
- Improved accessibility by focusing the activation shortcut dialog and making text reachable. Thanks [@chatasweetie](https://github.com/chatasweetie)!
- Moved the extension SDK to a stable Windows SDK and cleaned up message namespaces.
- Added path shortcuts: ~ to home, and / or \\ to system root, plus UNC support. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Fixed a race in cancellation handling to avoid InvalidOperationException. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Aligned separator styling with WinUI 3 for consistent visuals. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Added ARM64 PDBs to the Extensions SDK NuGet for better debugging.
- Added single-select filters to DynamicListPage and updated Windows Services sample.
- Updated main page placeholder text to better describe what can be searched. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Removed explicit WinAppSDK/WebView2 dependencies from toolkit and API. Thanks [@rluengen](https://github.com/rluengen)!
- Added a local keyboard hook to handle the GoBack key reliably. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Propagated alias changes safely and resolved conflicts across view models.
- Allowed providers to override Dispose with a virtual method.
- Fixed memory leaks by cleaning up removed or cancelled list items.
- Sorted DateTime extension results by relevance for better usability.
- Reduced search text “jiggling” by avoiding redundant change notifications.
- Centralized automation notifications in a UIHelper for better accessibility. Thanks [@chatasweetie](https://github.com/chatasweetie)!
- Preserved Adaptive Card action types during trimming via DynamicDependency.
- Added an acrylic backdrop and refined styling to the context menu. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Prevented disposed pages and Settings windows from handling stale messages. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Made the extension API easier to evolve without breaking clients.
- Added “evil” sample pages to help reproduce tricky bugs.
- Fixed WinGet trim-safety issues by replacing LINQ with manual iteration.
- Cancelled stale list fetches to avoid older results overwriting newer ones in CmdPal.
### Command Palette extensions
- Added settings to each provider to control which fallback commands are enabled. Thanks [@jiripolasek](https://github.com/jiripolasek)! for fixing a regression in this feature.
- Added sample code showing how Command Palette extensions can track when their pages are loaded or unloaded. [Check it out here](./src/modules/cmdpal/ext/SamplePagesExtension/OnLoadPage.cs).
- Fixed *Calculator* to accept regular spaces in numbers that use space separators. Thanks [@PesBandi](https://github.com/PesBandi)!
- Added a new setting to *Calculator* to make "Copy" the primary button (replacing “Save”) and enable "Close on Enter", streamlining the workflow. Thanks [@PesBandi](https://github.com/PesBandi)!
- Improved *Apps* indexing error handling and removed obsolete code. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Prevented apps from showing in search when the *Apps* extension is disabled. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Added ability to pin/unpin *Apps* using Ctrl+P shortcut.
- Added keyboard shortcuts to the *Apps* context menu items for faster access.
- Added all file context menu options to the *Apps* items context menu, making all file actions available there for better functionality.
- Streamlined All *Apps* extension settings by removing redundant descriptions, making the UI clearer.
- Added command history to the *Run* page for easier access to previous commands.
- Fixed directory path handling in *Run* fallback for better file navigation.
- Fixed URL fallback item hiding properly in *Web Search* extension when search query becomes invalid. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Added proper empty state message for *Web Search* extension when no results found. Thanks [@jiripolasek](https://github.com/jiripolasek)!
- Added fallback command to *Windows Settings* extension for better search results.
- Re-enabled *Clipboard History* feature with proper window handling.
- Improved *Add Bookmark* extension to automatically detect file, folder, or URL types without manual input.
- Updated terminology from "Kill process" to "End task" in *Window Walker* for consistency with Windows.
- Fixed minor grammar error in SamplePagesExtension code comments. Thanks [@purofle](https://github.com/purofle)!
- Improved empty states and ranking logic for multiple extensions. Thanks [@htcfreek](https://github.com/htcfreek)!
- Added app icons to the All Apps "Run" context command when available.
- Restored missing builtin icons by standardizing extension dependencies.
- Unblocked local deployment by adding WinAppSDK to two sample extensions.
### Hosts File Editor
- Added a "No leading spaces" option so active hosts entries can start at column 0 even when others are disabled. Thanks [@mohammed-saalim](https://github.com/mohammed-saalim)!
### Image Resizer
- Fixed Image Resizer localization by installing satellite resources under the WinUI 3 apps culture path.
### Mouse Utilities
- Added a new spotlight highlighting mode that creates a large transparent circle around your cursor with a backdrop effect, providing an alternative to the traditional circle highlight. Perfect for presentations where you want to focus attention on a specific area while dimming the rest of the screen.
- Introduced "Gliding cursor" to control the pointer and click with a single hotkey for better accessibility. Thanks [@mikehall-ms](https://github.com/mikehall-ms)!
### Mouse Without Borders
- Blocked Easy Mouse from switching machines during fullscreen apps, with an allow-list for exceptions. Thanks [@dot-tb](https://github.com/dot-tb)!
### Peek
- Added preview and thumbnail support for Binary G-code (.bgcode) files used in 3D printing. You can now see embedded thumbnails and preview these compressed 3D printing files directly in Peek and File Explorer. Thanks [@pedrolamas](https://github.com/pedrolamas)!
- Added Visual Studio shared project file types to XML preview and fixed bgcode handler registration. Thanks [@rezanid](https://github.com/rezanid)!
- Fixes bgcode preview handler registration and events for reliable previews. Thanks [@pedrolamas](https://github.com/pedrolamas)!
### PowerRename
- Changed the Explorer accelerator key to PowErRename to avoid clashing with the New menu. Thanks [@aaron-ni](https://github.com/aaron-ni)!
### Quick Accent
- Added Vietnamese language support to Quick Accent, mappings for Vietnamese vowels (a, e, i, o, u, y) and the letter d. Thanks [@octastylos-pseudodipteros](https://github.com/octastylos-pseudodipteros)!
- Remembered character usage across sessions so frequently used accents appear first. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Added Maltese language support with specific characters and the Euro symbol. Thanks [@rovercoder](https://github.com/rovercoder)!
- Reduced GPU usage issues by making the window Topmost only when the picker is visible. Thanks [@daverayment](https://github.com/daverayment)!
### Settings
- Completely redesigned the Settings dashboard with a modern card-based layout featuring organized sections for quick actions and shortcuts overview, replacing the old module list.
- Rewrote setting descriptions to be more concise and follow Windows writing style guidelines, making them easier to understand.
- Improved formatting and readability of release notes in the "What's New" section with better typography and spacing.
- Added missing deep link support for various settings pages (Peek, Quick Accent, PowerToys Run, etc.) so you can jump directly to specific settings.
- Resolved an issue where the settings page header would drift away from its position when resizing the settings window.
- Resolved a settings crash related to incompatible property names in ZoomIt configuration.
- Added telemetry to track usage of the new shortcut conflict detection workflow.
- Moved the shutdown action from the title bar to a footer menu item with confirmation. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Implemented comprehensive hotkey conflict detection with a dedicated resolution dialog.
- Added branded visuals for Office and Copilot keys in the KeyVisual control.
- Introduced Settings search with fuzzy matching and navigation to specific controls.
- Corrected Spanish localization so product names like Awake remain in English across Settings and OOBE.
- Simplified the Advanced Paste description in Settings for quicker reading and consistent capitalization. Thanks [@OldUser101](https://github.com/OldUser101)!
- Localized conflict messages in the conflict window and dialog.
### Installer
- Upgraded the installer to WiX 5 with silent "Files in Use" handling for smoother winget installs.
- Switched Win10 context menu modules to runtime registration and added cleanup on uninstall to avoid stale entries.
### Documentation
- Added detailed step-by-step instructions for first-time developers building the Command Palette module, including prerequisites and Visual Studio setup guidance. Thanks [@chatasweetie](https://github.com/chatasweetie)!
- **Fixed Broken SDK Link**: Corrected a broken markdown link in the Command Palette SDK README that was pointing to an incorrect directory path. Thanks [@ChrisGuzak](https://github.com/ChrisGuzak)!
- Added documentation for the "Open With Cursor" plugin that enables opening Visual Studio and VS Code recent files using Cursor AI. Thanks [@VictorNoxx](https://github.com/VictorNoxx)!
- Added documentation for two new community plugins - Hotkeys plugin for creating custom keyboard shortcuts, and RandomGen plugin for generating random data like passwords, colors, and placeholder text. Thanks [@ruslanlap](https://github.com/ruslanlap)!
- Adds docs for building the installer locally and testing winget installs.
- Fixed a broken style guide link in developer documentation. Thanks [@denizmaral](https://github.com/denizmaral)!
### Development
- Updated .NET libraries to 9.0.8 for performance and security. Thanks [@snickler](https://github.com/snickler)!
- Updated the spell check system to version 0.0.25 with better GitHub integration and SARIF reporting, plus fixed numerous spelling errors throughout the codebase including property names and documentation. Thanks [@jsoref](https://github.com/jsoref)!
- Cleaned up spelling check configuration to eliminate false positives and excessive noise that was appearing in every pull request, making the development process smoother.
- Replaced NuGet feed with Azure Artifacts for better package management.
- Implemented configurable UI test pipeline that can use pre-built official releases instead of building everything from scratch, reducing test execution time from 2+ hours.
- Replaced brittle pixel-by-pixel image comparison with perceptual hash (pHash) technology that's more robust to minor rendering differences - no more test failures due to anti-aliasing or compression artifacts.
- Reduced CI/fuzzing/UI test timeouts from 4 hours to 90 minutes, dramatically improving developer feedback loops and preventing long waits when builds get stuck.
- Standardized test project naming across the entire codebase and improved pipeline result identification by adding platform/install mode context to test run titles. Thanks [@khmyznikov](https://github.com/khmyznikov)!
- Added comprehensive UI test suites for multiple PowerToys modules including Command Palette, Advanced Paste, Peek, Text Extractor, and PowerRename - ensuring better reliability and quality.
- Enhanced UI test automation with command-line argument support, better session management, and improved element location methods using pattern matching to avoid failures from minor differences in exact matches.
- Excluded test and coverage DLLs from BinSkim scans to cut false positives and speed up security analysis.
- Simplified NOTICE maintenance by removing version numbers and filtering out Microsoft/System packages.
- Improved NuGet dependency validation to prevent package downgrades and catch issues during restore.
- Updated UTF.Unknown to a modern version to improve compatibility without breaking changes. Thanks [@304NotModified](https://github.com/304NotModified)!
- Refreshed package catalog in CI before installing dependencies to prevent Linux workflow failures.
- Refactored CmdPal tests with dependency injection and added coverage for queries and settings.
- Added unit tests to verify Close on Enter swaps Copy/Save as expected. Thanks [@mohammed-saalim](https://github.com/mohammed-saalim)!
- Added accessibility IDs to CmdPal UI for stable UI tests.
- Rewrote system command tests with a new test base and cleaner patterns.
- Added unit tests for WebSearch and Shell extensions with mockable settings.
- Added unit tests and abstractions for Apps and Bookmarks extensions.
- Cleans up AIgenerated tests; adds meaningful query tests across extensions.
- Removed the obsolete debug dialog from Settings for a smoother developer loop.
### What is being planned over the next few releases
For [v0.94][github-next-release-work], we'll work on the items below:
For [v0.95][github-next-release-work], we'll work on the items below:
- Continued Command Palette polish
- Working on Shortcut Guide v2 (Thanks [@noraa-junker](https://github.com/noraa-junker)!)
- Working on upgrading the installer to WiX 5
- Working on shortcut conflict detection
- Working on setting search
- Upgrading Keyboard Manager's editor UI
- UI tweaking utility with day/night theme switcher
- DSC v3 support for top utilities
- New UI automation tests
- Stability, bug fixes

View File

@@ -32,17 +32,8 @@ namespace ManagedCommon
/// <param name="isLocalLow">If the process using Logger is a low-privilege process.</param>
public static void InitializeLogger(string applicationLogPath, bool isLocalLow = false)
{
string basePath;
if (isLocalLow)
{
basePath = Environment.GetEnvironmentVariable("userprofile") + "\\appdata\\LocalLow\\Microsoft\\PowerToys" + applicationLogPath;
}
else
{
basePath = Constants.AppDataPath() + applicationLogPath;
}
string versionedPath = Path.Combine(basePath, Version);
string versionedPath = LogDirectoryPath(applicationLogPath, isLocalLow);
string basePath = Path.GetDirectoryName(versionedPath);
if (!Directory.Exists(versionedPath))
{
@@ -59,6 +50,22 @@ namespace ManagedCommon
Task.Run(() => DeleteOldVersionLogFolders(basePath, versionedPath));
}
public static string LogDirectoryPath(string applicationLogPath, bool isLocalLow = false)
{
string basePath;
if (isLocalLow)
{
basePath = Environment.GetEnvironmentVariable("userprofile") + "\\appdata\\LocalLow\\Microsoft\\PowerToys" + applicationLogPath;
}
else
{
basePath = Constants.AppDataPath() + applicationLogPath;
}
string versionedPath = Path.Combine(basePath, Version);
return versionedPath;
}
/// <summary>
/// Deletes old version log folders, keeping only the current version's folder.
/// </summary>

View File

@@ -19,6 +19,26 @@
class FileLocksmithModule : public PowertoyModuleIface
{
private:
// Update registration based on enabled state
void UpdateRegistration(bool enabled)
{
if (enabled)
{
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
FileLocksmithRuntimeRegistration::EnsureRegistered();
Logger::info(L"File Locksmith context menu registered");
#endif
}
else
{
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
FileLocksmithRuntimeRegistration::Unregister();
Logger::info(L"File Locksmith context menu unregistered");
#endif
}
}
public:
FileLocksmithModule()
{
@@ -88,21 +108,16 @@ public:
package::RegisterSparsePackage(path, packageUri);
}
}
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
FileLocksmithRuntimeRegistration::EnsureRegistered();
#endif
m_enabled = true;
UpdateRegistration(m_enabled);
}
virtual void disable() override
{
Logger::info(L"File Locksmith disabled");
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
FileLocksmithRuntimeRegistration::Unregister();
Logger::info(L"File Locksmith context menu unregistered (Win10)");
#endif
m_enabled = false;
UpdateRegistration(m_enabled);
}
virtual bool is_enabled() override
@@ -135,6 +150,7 @@ private:
{
m_enabled = FileLocksmithSettingsInstance().GetEnabled();
m_extended_only = FileLocksmithSettingsInstance().GetShowInExtendedContextMenu();
UpdateRegistration(m_enabled);
Trace::EnableFileLocksmith(m_enabled);
}

View File

@@ -21,6 +21,26 @@
// Note: Settings are managed via Settings and UI Settings
class NewModule : public PowertoyModuleIface
{
private:
// Update registration based on enabled state
void UpdateRegistration(bool enabled)
{
if (enabled)
{
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
NewPlusRuntimeRegistration::EnsureRegisteredWin10();
Logger::info(L"New+ context menu registered");
#endif
}
else
{
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
NewPlusRuntimeRegistration::Unregister();
Logger::info(L"New+ context menu unregistered");
#endif
}
}
public:
NewModule()
{
@@ -98,14 +118,9 @@ public:
{
newplus::utilities::register_msix_package();
}
else
{
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
NewPlusRuntimeRegistration::EnsureRegisteredWin10();
#endif
}
powertoy_new_enabled = true;
UpdateRegistration(powertoy_new_enabled);
}
virtual void disable() override
@@ -150,19 +165,14 @@ private:
{
Trace::EventToggleOnOff(false);
}
if (!package::IsWin11OrGreater())
{
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
NewPlusRuntimeRegistration::Unregister();
Logger::info(L"New+ context menu unregistered (Win10)");
#endif
}
powertoy_new_enabled = false;
UpdateRegistration(powertoy_new_enabled);
}
void init_settings()
{
powertoy_new_enabled = NewSettingsInstance().GetEnabled();
UpdateRegistration(powertoy_new_enabled);
}
};

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using ManagedCommon;
using Microsoft.CmdPal.UI.ViewModels.Commands;
using Microsoft.CmdPal.UI.ViewModels.Properties;
using Microsoft.CommandPalette.Extensions.Toolkit;
@@ -19,6 +20,10 @@ internal sealed partial class FallbackLogItem : FallbackCommandItem
Title = string.Empty;
_logMessagesPage.Name = string.Empty;
Subtitle = Properties.Resources.builtin_log_subtitle;
var logPath = Logger.LogDirectoryPath("\\CmdPal\\Logs\\");
var openLogCommand = new OpenFileCommand(logPath) { Name = Resources.builtin_log_folder_command_name };
MoreCommands = [new CommandContextItem(openLogCommand)];
}
public override void UpdateQuery(string query)

View File

@@ -27,7 +27,9 @@ public partial class MainListPage : DynamicListPage,
private readonly IServiceProvider _serviceProvider;
private readonly TopLevelCommandManager _tlcManager;
private IEnumerable<IListItem>? _filteredItems;
private IEnumerable<Scored<IListItem>>? _filteredItems;
private IEnumerable<Scored<IListItem>>? _filteredApps;
private IEnumerable<IListItem>? _allApps;
private bool _includeApps;
private bool _filteredItemsIncludesApps;
@@ -83,7 +85,7 @@ public partial class MainListPage : DynamicListPage,
}
else
{
RaiseItemsChanged(_tlcManager.TopLevelCommands.Count);
RaiseItemsChanged();
}
}
@@ -148,7 +150,13 @@ public partial class MainListPage : DynamicListPage,
{
lock (_tlcManager.TopLevelCommands)
{
return _filteredItems?.ToArray() ?? [];
var items = Enumerable.Empty<Scored<IListItem>>()
.Concat(_filteredItems is not null ? _filteredItems : [])
.Concat(_filteredApps is not null ? _filteredApps : [])
.OrderByDescending(o => o.Score)
.Select(s => s.Item)
.ToArray();
return items;
}
}
}
@@ -167,6 +175,8 @@ public partial class MainListPage : DynamicListPage,
{
_filteredItemsIncludesApps = _includeApps;
_filteredItems = null;
_filteredApps = null;
_allApps = null;
}
}
@@ -184,6 +194,8 @@ public partial class MainListPage : DynamicListPage,
{
_filteredItemsIncludesApps = _includeApps;
_filteredItems = null;
_filteredApps = null;
_allApps = null;
RaiseItemsChanged(commands.Count);
return;
}
@@ -193,35 +205,49 @@ public partial class MainListPage : DynamicListPage,
if (!newSearch.StartsWith(oldSearch, StringComparison.CurrentCultureIgnoreCase))
{
_filteredItems = null;
_filteredApps = null;
_allApps = null;
}
// If the internal state has changed, reset _filteredItems to reset the list.
if (_filteredItemsIncludesApps != _includeApps)
{
_filteredItems = null;
_filteredApps = null;
_allApps = null;
}
var newFilteredItems = _filteredItems?.Select(s => s.Item);
// If we don't have any previous filter results to work with, start
// with a list of all our commands & apps.
if (_filteredItems is null)
if (newFilteredItems is null && _filteredApps is null)
{
_filteredItems = commands;
newFilteredItems = commands;
_filteredItemsIncludesApps = _includeApps;
if (_includeApps)
{
IEnumerable<IListItem> apps = AllAppsCommandProvider.Page.GetItems();
var appIds = apps.Select(app => app.Command.Id).ToArray();
// Remove any top level pinned apps and use the apps from AllAppsCommandProvider.Page.GetItems()
// since they contain details.
_filteredItems = _filteredItems.Where(item => item.Command is not AppCommand);
_filteredItems = _filteredItems.Concat(apps);
_allApps = AllAppsCommandProvider.Page.GetItems();
}
}
// Produce a list of everything that matches the current filter.
_filteredItems = ListHelpers.FilterList<IListItem>(_filteredItems, SearchText, ScoreTopLevelItem);
RaiseItemsChanged(_filteredItems.Count());
_filteredItems = ListHelpers.FilterListWithScores<IListItem>(newFilteredItems ?? [], SearchText, ScoreTopLevelItem);
// Produce a list of filtered apps with the appropriate limit
if (_allApps is not null)
{
_filteredApps = ListHelpers.FilterListWithScores<IListItem>(_allApps, SearchText, ScoreTopLevelItem);
var appResultLimit = AllAppsCommandProvider.TopLevelResultLimit;
if (appResultLimit >= 0)
{
_filteredApps = _filteredApps.Take(appResultLimit);
}
}
RaiseItemsChanged();
}
}

View File

@@ -126,6 +126,10 @@ public class ExtensionWrapper : IExtensionWrapper
// We'll just return out nothing.
return;
}
else if (hr.Value != 0)
{
Logger.LogError($"Failed to find {ExtensionDisplayName}: {hr.Value}");
}
// Marshal.ThrowExceptionForHR(hr);
_extensionObject = MarshalInterface<IExtension>.FromAbi((nint)extensionPtr);

View File

@@ -285,6 +285,15 @@ namespace Microsoft.CmdPal.UI.ViewModels.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to View log folder.
/// </summary>
public static string builtin_log_folder_command_name {
get {
return ResourceManager.GetString("builtin_log_folder_command_name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to View log.
/// </summary>

View File

@@ -135,6 +135,9 @@
<data name="builtin_log_title" xml:space="preserve">
<value>View log</value>
</data>
<data name="builtin_log_folder_command_name" xml:space="preserve">
<value>View log folder</value>
</data>
<data name="builtin_reload_subtitle" xml:space="preserve">
<value>Reload Command Palette extensions</value>
</data>

View File

@@ -438,7 +438,7 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
<data name="NavigationPaneClosed" xml:space="preserve">
<value>Navigation pane closed</value>
</data>
<data name="NavigationPageOpened" xml:space="preserve">
<data name="NavigationPaneOpened" xml:space="preserve">
<value>Navigation page opened</value>
</data>
</root>

View File

@@ -3,9 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.CmdPal.Ext.Apps.Programs;
using Microsoft.CmdPal.Ext.Apps.Properties;
using Microsoft.CmdPal.Ext.Apps.State;
using Microsoft.CommandPalette.Extensions;
@@ -45,6 +43,28 @@ public partial class AllAppsCommandProvider : CommandProvider
PinnedAppsManager.Instance.PinStateChanged += OnPinStateChanged;
}
public static int TopLevelResultLimit
{
get
{
var limitSetting = AllAppsSettings.Instance.SearchResultLimit;
if (limitSetting is null)
{
return -1;
}
var quantity = -1;
if (int.TryParse(limitSetting, out var result))
{
quantity = result;
}
return quantity;
}
}
public override ICommandItem[] TopLevelCommands() => [_listItem, .._page.GetPinnedApps()];
public ICommandItem? LookupApp(string displayName)

View File

@@ -20,6 +20,16 @@ public class AllAppsSettings : JsonSettingsManager, ISettingsInterface
private static string Experimental(string propertyName) => $"{_namespace}.experimental.{propertyName}";
private static readonly List<ChoiceSetSetting.Choice> _searchResultLimitChoices =
[
new ChoiceSetSetting.Choice(Resources.limit_none, "-1"),
new ChoiceSetSetting.Choice(Resources.limit_0, "0"),
new ChoiceSetSetting.Choice(Resources.limit_1, "1"),
new ChoiceSetSetting.Choice(Resources.limit_5, "5"),
new ChoiceSetSetting.Choice(Resources.limit_10, "10"),
new ChoiceSetSetting.Choice(Resources.limit_20, "20"),
];
#pragma warning disable SA1401 // Fields should be private
internal static AllAppsSettings Instance = new();
#pragma warning restore SA1401 // Fields should be private
@@ -42,6 +52,14 @@ public class AllAppsSettings : JsonSettingsManager, ISettingsInterface
public bool EnablePathEnvironmentVariableSource => _enablePathEnvironmentVariableSource.Value;
private readonly ChoiceSetSetting _searchResultLimitSource = new(
Namespaced(nameof(SearchResultLimit)),
Resources.limit_fallback_results_source,
Resources.limit_fallback_results_source_description,
_searchResultLimitChoices);
public string SearchResultLimit => _searchResultLimitSource.Value ?? string.Empty;
private readonly ToggleSetting _enableStartMenuSource = new(
Namespaced(nameof(EnableStartMenuSource)),
Resources.enable_start_menu_source,
@@ -87,6 +105,7 @@ public class AllAppsSettings : JsonSettingsManager, ISettingsInterface
Settings.Add(_enableDesktopSource);
Settings.Add(_enableRegistrySource);
Settings.Add(_enablePathEnvironmentVariableSource);
Settings.Add(_searchResultLimitSource);
// Load settings from file upon initialization
LoadSettings();

View File

@@ -159,6 +159,78 @@ namespace Microsoft.CmdPal.Ext.Apps.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to 0.
/// </summary>
internal static string limit_0 {
get {
return ResourceManager.GetString("limit_0", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 1.
/// </summary>
internal static string limit_1 {
get {
return ResourceManager.GetString("limit_1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 10.
/// </summary>
internal static string limit_10 {
get {
return ResourceManager.GetString("limit_10", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 20.
/// </summary>
internal static string limit_20 {
get {
return ResourceManager.GetString("limit_20", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 5.
/// </summary>
internal static string limit_5 {
get {
return ResourceManager.GetString("limit_5", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Limit the number of applications returned from the top level.
/// </summary>
internal static string limit_fallback_results_source {
get {
return ResourceManager.GetString("limit_fallback_results_source", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Limit fallback results to n apps.
/// </summary>
internal static string limit_fallback_results_source_description {
get {
return ResourceManager.GetString("limit_fallback_results_source_description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to None.
/// </summary>
internal static string limit_none {
get {
return ResourceManager.GetString("limit_none", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open containing folder.
/// </summary>

View File

@@ -198,4 +198,28 @@
<data name="unpin_app" xml:space="preserve">
<value>Unpin</value>
</data>
</root>
<data name="limit_1" xml:space="preserve">
<value>1</value>
</data>
<data name="limit_5" xml:space="preserve">
<value>5</value>
</data>
<data name="limit_10" xml:space="preserve">
<value>10</value>
</data>
<data name="limit_20" xml:space="preserve">
<value>20</value>
</data>
<data name="limit_fallback_results_source" xml:space="preserve">
<value>Limit the number of applications returned from the top level</value>
</data>
<data name="limit_fallback_results_source_description" xml:space="preserve">
<value>Limit fallback results to n apps</value>
</data>
<data name="limit_0" xml:space="preserve">
<value>0</value>
</data>
<data name="limit_none" xml:space="preserve">
<value>Unlimited</value>
</data>
</root>

View File

@@ -79,16 +79,22 @@ public sealed partial class TimeDateCalculator
}
else
{
List<(int Score, AvailableResult Item)> itemScores = [];
// Generate filtered list of results
foreach (var f in availableFormats)
{
var score = f.Score(query, f.Label, f.AlternativeSearchTag);
if (score > 0)
{
results.Add(f.ToListItem());
itemScores.Add((score, f));
}
}
results = itemScores
.OrderByDescending(s => s.Score)
.Select(s => s.Item.ToListItem())
.ToList();
}
if (results.Count == 0)

View File

@@ -43,13 +43,18 @@ public partial class ListHelpers
}
public static IEnumerable<T> FilterList<T>(IEnumerable<T> items, string query, Func<string, T, int> scoreFunction)
{
return FilterListWithScores<T>(items, query, scoreFunction)
.Select(score => score.Item);
}
public static IEnumerable<Scored<T>> FilterListWithScores<T>(IEnumerable<T> items, string query, Func<string, T, int> scoreFunction)
{
var scores = items
.Select(li => new Scored<T>() { Item = li, Score = scoreFunction(query, li) })
.Where(score => score.Score > 0)
.OrderByDescending(score => score.Score);
return scores
.Select(score => score.Item);
return scores;
}
/// <summary>

View File

@@ -43,11 +43,32 @@ private:
//contains the non localized key of the powertoy
std::wstring app_key;
// Update registration based on enabled state
void UpdateRegistration(bool enabled)
{
if (enabled)
{
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
ImageResizerRuntimeRegistration::EnsureRegistered();
Logger::info(L"ImageResizer context menu registered");
#endif
}
else
{
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
ImageResizerRuntimeRegistration::Unregister();
Logger::info(L"ImageResizer context menu unregistered");
#endif
}
}
public:
// Constructor
ImageResizerModule()
{
m_enabled = CSettingsInstance().GetEnabled();
UpdateRegistration(m_enabled);
app_name = GET_RESOURCE_STRING(IDS_IMAGERESIZER);
app_key = ImageResizerConstants::ModuleKey;
LoggerHelpers::init_logger(app_key, L"ModuleInterface", LogSettings::imageResizerLoggerName);
@@ -112,10 +133,7 @@ public:
package::RegisterSparsePackage(path, packageUri);
}
}
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
ImageResizerRuntimeRegistration::EnsureRegistered();
#endif
UpdateRegistration(m_enabled);
Trace::EnableImageResizer(m_enabled);
}
@@ -123,11 +141,8 @@ public:
virtual void disable()
{
m_enabled = false;
UpdateRegistration(m_enabled);
Trace::EnableImageResizer(m_enabled);
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
ImageResizerRuntimeRegistration::Unregister();
Logger::info(L"ImageResizer context menu unregistered (Win10)");
#endif
}
// Returns if the powertoys is enabled

View File

@@ -168,6 +168,25 @@ private:
//contains the non localized key of the powertoy
std::wstring app_key;
// Update registration based on enabled state
void UpdateRegistration(bool enabled)
{
if (enabled)
{
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
PowerRenameRuntimeRegistration::EnsureRegistered();
Logger::info(L"PowerRename context menu registered");
#endif
}
else
{
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
PowerRenameRuntimeRegistration::Unregister();
Logger::info(L"PowerRename context menu unregistered");
#endif
}
}
public:
// Return the localized display name of the powertoy
virtual PCWSTR get_name() override
@@ -202,9 +221,7 @@ public:
package::RegisterSparsePackage(path, packageUri);
}
}
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
PowerRenameRuntimeRegistration::EnsureRegistered();
#endif
UpdateRegistration(m_enabled);
}
// Disable the powertoy
@@ -212,10 +229,7 @@ public:
{
m_enabled = false;
Logger::info(L"PowerRename disabled");
#if defined(ENABLE_REGISTRATION) || defined(NDEBUG)
PowerRenameRuntimeRegistration::Unregister();
Logger::info(L"PowerRename context menu unregistered (Win10)");
#endif
UpdateRegistration(m_enabled);
}
// Returns if the powertoy is enabled
@@ -315,6 +329,7 @@ public:
void init_settings()
{
m_enabled = CSettingsInstance().GetEnabled();
UpdateRegistration(m_enabled);
Trace::EnablePowerRename(m_enabled);
}

View File

@@ -19,6 +19,13 @@ namespace Microsoft.PowerToys.Tools.XamlIndexBuilder
"ShellPage.xaml",
};
// Hardcoded panel-to-page mapping (temporary until generic panel host mapping is needed)
// Key: panel file base name (without .xaml), Value: owning page base name
private static readonly Dictionary<string, string> PanelPageMapping = new(StringComparer.OrdinalIgnoreCase)
{
{ "MouseJumpPanel", "MouseUtilsPage" },
};
private static JsonSerializerOptions serializeOption = new()
{
WriteIndented = true,
@@ -33,32 +40,117 @@ namespace Microsoft.PowerToys.Tools.XamlIndexBuilder
Environment.Exit(1);
}
string xamlDirectory = args[0];
string xamlRootDirectory = args[0];
string outputFile = args[1];
if (!Directory.Exists(xamlDirectory))
if (!Directory.Exists(xamlRootDirectory))
{
Debug.WriteLine($"Error: Directory '{xamlDirectory}' does not exist.");
Debug.WriteLine($"Error: Directory '{xamlRootDirectory}' does not exist.");
Environment.Exit(1);
}
try
{
var searchableElements = new List<SettingEntry>();
var xamlFiles = Directory.GetFiles(xamlDirectory, "*.xaml", SearchOption.AllDirectories);
var processedFiles = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
foreach (var xamlFile in xamlFiles)
void ScanDirectory(string root)
{
var fileName = Path.GetFileName(xamlFile);
if (ExcludedXamlFiles.Contains(fileName))
if (!Directory.Exists(root))
{
// Skip ShellPage.xaml as it contains many elements not relevant for search
continue;
return;
}
Debug.WriteLine($"Processing: {fileName}");
var elements = ExtractSearchableElements(xamlFile);
searchableElements.AddRange(elements);
Debug.WriteLine($"[XamlIndexBuilder] Scanning root: {root}");
var xamlFilesLocal = Directory.GetFiles(root, "*.xaml", SearchOption.AllDirectories);
foreach (var xamlFile in xamlFilesLocal)
{
var fullPath = Path.GetFullPath(xamlFile);
if (processedFiles.Contains(fullPath))
{
continue; // already handled (can happen if overlapping directories)
}
var fileName = Path.GetFileName(xamlFile);
if (ExcludedXamlFiles.Contains(fileName))
{
continue; // explicitly excluded
}
Debug.WriteLine($"Processing: {fileName}");
var elements = ExtractSearchableElements(xamlFile);
// Apply hardcoded panel mapping override
var baseName = Path.GetFileNameWithoutExtension(xamlFile);
if (PanelPageMapping.TryGetValue(baseName, out var hostPage))
{
for (int i = 0; i < elements.Count; i++)
{
var entry = elements[i];
entry.PageTypeName = hostPage;
elements[i] = entry;
}
}
searchableElements.AddRange(elements);
processedFiles.Add(fullPath);
}
}
// Scan well-known subdirectories under the provided root
var subDirs = new[] { "Views", "Panels" };
foreach (var sub in subDirs)
{
ScanDirectory(Path.Combine(xamlRootDirectory, sub));
}
// Fallback: also scan root directly (in case some XAML lives at root level)
ScanDirectory(xamlRootDirectory);
// -----------------------------------------------------------------------------
// Explicit include section: add specific XAML files that we always want indexed
// even if future logic excludes them or they live outside typical scan patterns.
// Add future files to the ExplicitExtraXamlFiles array below.
// -----------------------------------------------------------------------------
string[] explicitExtraXamlFiles = new[]
{
"MouseJumpPanel.xaml", // Mouse Jump settings panel
};
foreach (var extraFileName in explicitExtraXamlFiles)
{
try
{
var matches = Directory.GetFiles(xamlRootDirectory, extraFileName, SearchOption.AllDirectories);
foreach (var match in matches)
{
var full = Path.GetFullPath(match);
if (processedFiles.Contains(full))
{
continue; // already processed in general scan
}
Debug.WriteLine($"Processing (explicit include): {extraFileName}");
var elements = ExtractSearchableElements(full);
var baseName = Path.GetFileNameWithoutExtension(full);
if (PanelPageMapping.TryGetValue(baseName, out var hostPage))
{
for (int i = 0; i < elements.Count; i++)
{
var entry = elements[i];
entry.PageTypeName = hostPage;
elements[i] = entry;
}
}
searchableElements.AddRange(elements);
processedFiles.Add(full);
}
}
catch (Exception ex)
{
Debug.WriteLine($"Explicit include failed for {extraFileName}: {ex.Message}");
}
}
searchableElements = searchableElements.OrderBy(e => e.PageTypeName).ThenBy(e => e.ElementName).ToList();
@@ -97,15 +189,15 @@ namespace Microsoft.PowerToys.Tools.XamlIndexBuilder
.Where(e => e.Name.LocalName == "SettingsPageControl")
.Where(e => e.Attribute(x + "Uid") != null);
// Extract SettingsCard elements
// Extract SettingsCard elements (support both Name and x:Name)
var settingsElements = doc.Descendants()
.Where(e => e.Name.LocalName == "SettingsCard")
.Where(e => e.Attribute("Name") != null || e.Attribute(x + "Uid") != null);
.Where(e => e.Attribute("Name") != null || e.Attribute(x + "Name") != null || e.Attribute(x + "Uid") != null);
// Extract SettingsExpander elements
// Extract SettingsExpander elements (support both Name and x:Name)
var settingsExpanderElements = doc.Descendants()
.Where(e => e.Name.LocalName == "SettingsExpander")
.Where(e => e.Attribute("Name") != null || e.Attribute(x + "Uid") != null);
.Where(e => e.Attribute("Name") != null || e.Attribute(x + "Name") != null || e.Attribute(x + "Uid") != null);
// Process SettingsPageControl elements
foreach (var element in settingsPageElements)
@@ -185,16 +277,36 @@ namespace Microsoft.PowerToys.Tools.XamlIndexBuilder
public static string GetElementName(XElement element, XNamespace x)
{
// Get Name attribute (we call it ElementName in our indexing system)
var name = element.Attribute("Name")?.Value;
if (string.IsNullOrEmpty(name))
{
name = element.Attribute(x + "Name")?.Value;
}
return name;
}
public static string GetElementUid(XElement element, XNamespace x)
{
// Try x:Uid
// Try x:Uid on the element itself
var uid = element.Attribute(x + "Uid")?.Value;
return uid;
if (!string.IsNullOrWhiteSpace(uid))
{
return uid;
}
// Fallback: check the first direct child element's x:Uid
var firstChild = element.Elements().FirstOrDefault();
if (firstChild != null)
{
var childUid = firstChild.Attribute(x + "Uid")?.Value;
if (!string.IsNullOrWhiteSpace(childUid))
{
return childUid;
}
}
return null;
}
public static string GetParentElementName(XElement element, XNamespace x)
@@ -211,6 +323,11 @@ namespace Microsoft.PowerToys.Tools.XamlIndexBuilder
if (expanderParent?.Name.LocalName == "SettingsExpander")
{
var expanderName = expanderParent.Attribute("Name")?.Value;
if (string.IsNullOrEmpty(expanderName))
{
expanderName = expanderParent.Attribute(x + "Name")?.Value;
}
if (!string.IsNullOrEmpty(expanderName))
{
return expanderName;
@@ -221,6 +338,11 @@ namespace Microsoft.PowerToys.Tools.XamlIndexBuilder
{
// Direct child of SettingsExpander
var expanderName = current.Attribute("Name")?.Value;
if (string.IsNullOrEmpty(expanderName))
{
expanderName = current.Attribute(x + "Name")?.Value;
}
if (!string.IsNullOrEmpty(expanderName))
{
return expanderName;

View File

@@ -29,16 +29,15 @@
<!-- Remove UI library reference to avoid pulling WindowsDesktop runtime (WindowsBase) -->
<PropertyGroup>
<!-- Fallback to dotnet if not provided by the environment -->
<DotNetExe Condition="'$(DotNetExe)' == ''">dotnet</DotNetExe>
<XamlViewsDir Condition="'$(XamlViewsDir)' == ''">$(MSBuildProjectDirectory)\..\Settings.UI\SettingsXAML\Views</XamlViewsDir>
<XamlRootDir Condition="'$(XamlRootDir)' == ''">$(MSBuildProjectDirectory)\..\Settings.UI\SettingsXAML</XamlRootDir>
<XamlRootDir Condition="'$(XamlViewsDir)' != ''">$([System.IO.Path]::GetDirectoryName('$(XamlViewsDir)'))</XamlRootDir>
<GeneratedJsonFile Condition="'$(GeneratedJsonFile)' == ''">$(MSBuildProjectDirectory)\..\Settings.UI\Assets\Settings\search.index.json</GeneratedJsonFile>
</PropertyGroup>
<Target Name="GenerateSearchIndexSelf" AfterTargets="Build">
<RemoveDir Directories="$(MSBuildProjectDirectory)\obj\ARM64;$(MSBuildProjectDirectory)\obj\x64;$(MSBuildProjectDirectory)\bin" />
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName('$(GeneratedJsonFile)'))" />
<Message Importance="high" Text="[XamlIndexBuilder] Generating search index. Views='$(XamlViewsDir)'; Out='$(GeneratedJsonFile)'; Tool='$(TargetPath)'; DotNet='$(DotNetExe)'." />
<!-- Execute via dotnet so host architecture doesn't need to match -->
<Exec Command="&quot;$(DotNetExe)&quot; &quot;$(TargetPath)&quot; &quot;$(XamlViewsDir)&quot; &quot;$(GeneratedJsonFile)&quot;" />
<Message Importance="high" Text="[XamlIndexBuilder] Generating search index. Root='$(XamlRootDir)'; Out='$(GeneratedJsonFile)'; Tool='$(TargetPath)'; DotNet='$(DotNetExe)'." />
<Exec Command="&quot;$(DotNetExe)&quot; &quot;$(TargetPath)&quot; &quot;$(XamlRootDir)&quot; &quot;$(GeneratedJsonFile)&quot;" />
</Target>
</Project>

View File

@@ -6,22 +6,22 @@ using System;
using System.Numerics;
using System.Threading.Tasks;
using CommunityToolkit.WinUI.Controls;
using Microsoft.PowerToys.Settings.UI.Controls;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Hosting;
using Microsoft.UI.Xaml.Media;
using Windows.UI;
namespace Microsoft.PowerToys.Settings.UI.Helpers;
public abstract partial class NavigatablePage : Page
public abstract partial class NavigablePage : Page
{
private const int ExpandWaitDuration = 500;
private const int AnimationDuration = 1000;
private const int AnimationDuration = 1850;
private NavigationParams _pendingNavigationParams;
public NavigatablePage()
public NavigablePage()
{
Loaded += OnPageLoaded;
}
@@ -43,13 +43,6 @@ public abstract partial class NavigatablePage : Page
private async void OnPageLoaded(object sender, RoutedEventArgs e)
{
// If we have navigation parameters, disable default focus in SettingsPageControl
// to allow proper focus management of the target element
if (_pendingNavigationParams != null && !string.IsNullOrEmpty(_pendingNavigationParams.ElementName))
{
SetSettingsPageControlDefaultFocus(false);
}
if (_pendingNavigationParams != null && !string.IsNullOrEmpty(_pendingNavigationParams.ElementName))
{
// First, expand parent if specified
@@ -74,12 +67,6 @@ public abstract partial class NavigatablePage : Page
AnimationDesired = true,
});
// Ensure the target element gets focus after bringing it into view
if (target is Control targetControl)
{
targetControl.Focus(FocusState.Programmatic);
}
await OnTargetElementNavigatedAsync(target, _pendingNavigationParams.ElementName);
_pendingNavigationParams = null;
@@ -93,21 +80,24 @@ public abstract partial class NavigatablePage : Page
return;
}
// Attempt to set keyboard focus so that screen readers announce the element and keyboard users land directly on it.
TrySetFocus(target);
// Get the visual and compositor
var visual = ElementCompositionPreview.GetElementVisual(target);
var compositor = visual.Compositor;
// Create a subtle glow effect using drop shadow
var dropShadow = compositor.CreateDropShadow();
dropShadow.Color = Microsoft.UI.Colors.Gray;
dropShadow.BlurRadius = 8f;
dropShadow.Color = (Color)Application.Current.Resources["SystemAccentColorLight2"];
dropShadow.BlurRadius = 16f;
dropShadow.Opacity = 0f;
dropShadow.Offset = new Vector3(0, 0, 0);
var spriteVisual = compositor.CreateSpriteVisual();
spriteVisual.Size = new Vector2((float)target.ActualWidth + 16, (float)target.ActualHeight + 16);
spriteVisual.Size = new Vector2((float)target.ActualWidth + 8, (float)target.ActualHeight + 8);
spriteVisual.Shadow = dropShadow;
spriteVisual.Offset = new Vector3(-8, -8, 0);
spriteVisual.Offset = new Vector3(-4, -4, 0);
// Insert the shadow visual behind the target element
ElementCompositionPreview.SetElementChildVisual(target, spriteVisual);
@@ -120,67 +110,132 @@ public abstract partial class NavigatablePage : Page
fadeAnimation.Duration = TimeSpan.FromMilliseconds(AnimationDuration);
dropShadow.StartAnimation("Opacity", fadeAnimation);
if (target is Control ctrl)
{
// TODO: ability to adjust brush color and animation from settings.
var originalBackground = ctrl.Background;
var highlightBrush = new SolidColorBrush();
var grayColor = Microsoft.UI.Colors.Gray;
grayColor.A = 50; // Very subtle transparency
highlightBrush.Color = grayColor;
// Apply the highlight
ctrl.Background = highlightBrush;
// Wait for animation to complete
await Task.Delay(AnimationDuration);
// Restore original background
ctrl.Background = originalBackground;
}
else
{
// For non-control elements, just wait for the glow animation
await Task.Delay(AnimationDuration);
}
await Task.Delay(AnimationDuration);
// Clean up the shadow visual
ElementCompositionPreview.SetElementChildVisual(target, null);
}
private static void TrySetFocus(FrameworkElement target)
{
try
{
// Prefer Control.Focus when available.
if (target is Control ctrl)
{
// Ensure it can receive focus.
if (!ctrl.IsTabStop)
{
ctrl.IsTabStop = true;
}
ctrl.Focus(FocusState.Programmatic);
}
// Target is not a Control. Find first focusable descendant Control.
var focusCandidate = FindFirstFocusableDescendant(target);
if (focusCandidate != null)
{
if (!focusCandidate.IsTabStop)
{
focusCandidate.IsTabStop = true;
}
focusCandidate.Focus(FocusState.Programmatic);
return;
}
// Fallback: attempt to focus parent control if no descendant found.
if (target.Parent is Control parent)
{
if (!parent.IsTabStop)
{
parent.IsTabStop = true;
}
parent.Focus(FocusState.Programmatic);
}
}
catch
{
// Swallow focus exceptions; not critical. Could log if logging enabled.
// Leave the default focus as it is.
}
}
private static Control FindFirstFocusableDescendant(FrameworkElement root)
{
if (root == null)
{
return null;
}
var queue = new System.Collections.Generic.Queue<DependencyObject>();
queue.Enqueue(root);
while (queue.Count > 0)
{
var current = queue.Dequeue();
if (current is Control c && c.IsEnabled && c.Visibility == Visibility.Visible)
{
return c;
}
int count = VisualTreeHelper.GetChildrenCount(current);
for (int i = 0; i < count; i++)
{
queue.Enqueue(VisualTreeHelper.GetChild(current, i));
}
}
return null;
}
protected FrameworkElement FindElementByName(string name)
{
var element = this.FindName(name) as FrameworkElement;
return element;
}
private void SetSettingsPageControlDefaultFocus(bool shouldSetDefaultFocus)
{
// Find any SettingsPageControl in the page and set the focus behavior
var settingsPageControl = FindSettingsPageControl(this);
if (settingsPageControl != null)
if (element != null)
{
settingsPageControl.ShouldSetDefaultFocus = shouldSetDefaultFocus;
}
}
private SettingsPageControl FindSettingsPageControl(DependencyObject parent)
{
if (parent is SettingsPageControl settingsPageControl)
{
return settingsPageControl;
return element;
}
int childCount = Microsoft.UI.Xaml.Media.VisualTreeHelper.GetChildrenCount(parent);
for (int i = 0; i < childCount; i++)
if (this.Content is DependencyObject root)
{
var child = Microsoft.UI.Xaml.Media.VisualTreeHelper.GetChild(parent, i);
var result = FindSettingsPageControl(child);
if (result != null)
var found = FindInDescendants(root, name);
if (found != null)
{
return result;
return found;
}
}
return null;
}
private static FrameworkElement FindInDescendants(DependencyObject root, string name)
{
if (root == null || string.IsNullOrEmpty(name))
{
return null;
}
var queue = new System.Collections.Generic.Queue<DependencyObject>();
queue.Enqueue(root);
while (queue.Count > 0)
{
var current = queue.Dequeue();
if (current is FrameworkElement fe)
{
var local = fe.FindName(name) as FrameworkElement;
if (local != null)
{
return local;
}
}
int count = VisualTreeHelper.GetChildrenCount(current);
for (int i = 0; i < count; i++)
{
var child = VisualTreeHelper.GetChild(current, i);
queue.Enqueue(child);
}
}

View File

@@ -25,6 +25,7 @@
<None Remove="SettingsXAML\Controls\Dashboard\CheckUpdateControl.xaml" />
<None Remove="SettingsXAML\Controls\Dashboard\ShortcutConflictControl.xaml" />
<None Remove="SettingsXAML\Controls\KeyVisual\KeyCharPresenter.xaml" />
<None Remove="SettingsXAML\Controls\TitleBar\TitleBar.xaml" />
</ItemGroup>
<ItemGroup>
<Page Remove="SettingsXAML\App.xaml" />
@@ -63,7 +64,6 @@
<PackageReference Include="CommunityToolkit.WinUI.Extensions" />
<PackageReference Include="CommunityToolkit.WinUI.Converters" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Markdown" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.TitleBar" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Private.Uri" />
<PackageReference Include="System.Text.RegularExpressions" />
@@ -156,7 +156,8 @@
</None>
<None Update="Assets\Settings\Scripts\DisableModule.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</None> <Page Update="SettingsXAML\Controls\TitleBar\TitleBar.xaml">
</Page>
<Page Update="SettingsXAML\Controls\KeyVisual\KeyCharPresenter.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -180,14 +181,8 @@
</Page>
</ItemGroup>
<!-- Removed nested publish/exec and copy targets. -->
<!-- Build XamlIndexBuilder before compiling Settings to ensure the search index exists without taking a project reference. -->
<Target Name="BuildXamlIndexBeforeSettings" BeforeTargets="CoreCompile">
<Message Importance="high" Text="[Settings] Building XamlIndexBuilder prior to compile. Views='$(MSBuildProjectDirectory)\SettingsXAML\Views' Out='$(GeneratedJsonFile)'" />
<MSBuild
Projects="..\Settings.UI.XamlIndexBuilder\Settings.UI.XamlIndexBuilder.csproj"
Targets="Build"
Properties="Configuration=$(Configuration);Platform=Any CPU;TargetFramework=net9.0;XamlViewsDir=$(MSBuildProjectDirectory)\SettingsXAML\Views;GeneratedJsonFile=$(GeneratedJsonFile)" />
<MSBuild Projects="..\Settings.UI.XamlIndexBuilder\Settings.UI.XamlIndexBuilder.csproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=Any CPU;TargetFramework=net9.0;XamlViewsDir=$(MSBuildProjectDirectory)\SettingsXAML\Views;GeneratedJsonFile=$(GeneratedJsonFile)" />
</Target>
</Project>

View File

@@ -170,7 +170,7 @@ namespace Microsoft.PowerToys.Settings.UI.Services
if (string.IsNullOrEmpty(header))
{
Debug.WriteLine($"[SearchIndexService] WARNING: No header localization found for ElementUid: '{elementUid}'");
header = GetString(resourceLoader, $"{elementUid}/Content");
}
return (header, description);

View File

@@ -11,6 +11,7 @@
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<ResourceDictionary Source="/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml" />
<ResourceDictionary Source="/SettingsXAML/Controls/KeyVisual/KeyCharPresenter.xaml" />
<ResourceDictionary Source="/SettingsXAML/Controls/TitleBar/TitleBar.xaml" />
<ResourceDictionary Source="/SettingsXAML/Styles/TextBlock.xaml" />
<ResourceDictionary Source="/SettingsXAML/Styles/Button.xaml" />
<ResourceDictionary Source="/SettingsXAML/Styles/InfoBadge.xaml" />

View File

@@ -61,12 +61,6 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
set { SetValue(ModuleContentProperty, value); }
}
public bool ShouldSetDefaultFocus
{
get { return (bool)GetValue(ShouldSetDefaultFocusProperty); }
set { SetValue(ShouldSetDefaultFocusProperty, value); }
}
public static readonly DependencyProperty ModuleTitleProperty = DependencyProperty.Register(nameof(ModuleTitle), typeof(string), typeof(SettingsPageControl), new PropertyMetadata(defaultValue: null));
public static readonly DependencyProperty ModuleDescriptionProperty = DependencyProperty.Register(nameof(ModuleDescription), typeof(string), typeof(SettingsPageControl), new PropertyMetadata(defaultValue: null));
public static readonly DependencyProperty ModuleImageSourceProperty = DependencyProperty.Register(nameof(ModuleImageSource), typeof(Uri), typeof(SettingsPageControl), new PropertyMetadata(null));
@@ -74,15 +68,10 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
public static readonly DependencyProperty SecondaryLinksHeaderProperty = DependencyProperty.Register(nameof(SecondaryLinksHeader), typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string)));
public static readonly DependencyProperty SecondaryLinksProperty = DependencyProperty.Register(nameof(SecondaryLinks), typeof(ObservableCollection<PageLink>), typeof(SettingsPageControl), new PropertyMetadata(new ObservableCollection<PageLink>()));
public static readonly DependencyProperty ModuleContentProperty = DependencyProperty.Register(nameof(ModuleContent), typeof(object), typeof(SettingsPageControl), new PropertyMetadata(new Grid()));
public static readonly DependencyProperty ShouldSetDefaultFocusProperty = DependencyProperty.Register(nameof(ShouldSetDefaultFocus), typeof(bool), typeof(SettingsPageControl), new PropertyMetadata(true));
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
// Only set default focus if there's no pending navigation (e.g., from search results)
if (ShouldSetDefaultFocus)
{
PrimaryLinksControl.Focus(FocusState.Programmatic);
}
PrimaryLinksControl.Focus(FocusState.Programmatic);
}
}
}

View File

@@ -548,18 +548,14 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
}
}
if (conflictingModules.Count > 0)
var moduleNames = conflictingModules.ToArray();
if (string.Equals(moduleNames[0], "System", StringComparison.OrdinalIgnoreCase))
{
var moduleNames = conflictingModules.ToArray();
var conflictMessage = moduleNames.Length == 1
? $"Conflict detected with {moduleNames[0]}"
: $"Conflicts detected with: {string.Join(", ", moduleNames)}";
c.ConflictMessage = conflictMessage;
c.ConflictMessage = ResourceLoaderInstance.ResourceLoader.GetString("SysHotkeyConflictTooltipText");
}
else
{
c.ConflictMessage = "Conflict detected with unknown module";
c.ConflictMessage = ResourceLoaderInstance.ResourceLoader.GetString("InAppHotkeyConflictTooltipText");
}
c.HasConflict = true;

View File

@@ -64,7 +64,7 @@
IsTabStop="{Binding ElementName=ShortcutContentControl, Path=IsWarningAltGr, Mode=OneWay}"
Severity="Warning" />
<InfoBar
Title="Hotkey Conflict"
x:Uid="WarningShortcutConflict"
IsClosable="False"
IsOpen="{Binding ElementName=ShortcutContentControl, Path=HasConflict, Mode=OneWay}"
IsTabStop="{Binding ElementName=ShortcutContentControl, Path=HasConflict, Mode=OneWay}"

View File

@@ -0,0 +1,229 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls;
public partial class TitleBar : Control
{
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="Icon"/> property.
/// </summary>
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(nameof(Icon), typeof(IconElement), typeof(TitleBar), new PropertyMetadata(null, IconChanged));
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="Title"/> property.
/// </summary>
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(nameof(Title), typeof(string), typeof(TitleBar), new PropertyMetadata(default(string)));
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="Subtitle"/> property.
/// </summary>
public static readonly DependencyProperty SubtitleProperty = DependencyProperty.Register(nameof(Subtitle), typeof(string), typeof(TitleBar), new PropertyMetadata(default(string)));
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="Content"/> property.
/// </summary>
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(nameof(Content), typeof(object), typeof(TitleBar), new PropertyMetadata(null, ContentChanged));
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="Footer"/> property.
/// </summary>
public static readonly DependencyProperty FooterProperty = DependencyProperty.Register(nameof(Footer), typeof(object), typeof(TitleBar), new PropertyMetadata(null, FooterChanged));
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="IsBackButtonVisible"/> property.
/// </summary>
public static readonly DependencyProperty IsBackButtonVisibleProperty = DependencyProperty.Register(nameof(IsBackButtonVisible), typeof(bool), typeof(TitleBar), new PropertyMetadata(false, IsBackButtonVisibleChanged));
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="IsPaneButtonVisible"/> property.
/// </summary>
public static readonly DependencyProperty IsPaneButtonVisibleProperty = DependencyProperty.Register(nameof(IsPaneButtonVisible), typeof(bool), typeof(TitleBar), new PropertyMetadata(false, IsPaneButtonVisibleChanged));
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="DisplayMode"/> property.
/// </summary>
public static readonly DependencyProperty DisplayModeProperty = DependencyProperty.Register(nameof(DisplayMode), typeof(DisplayMode), typeof(TitleBar), new PropertyMetadata(DisplayMode.Standard, DisplayModeChanged));
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="CompactStateBreakpoint
/// "/> property.
/// </summary>
public static readonly DependencyProperty CompactStateBreakpointProperty = DependencyProperty.Register(nameof(CompactStateBreakpoint), typeof(int), typeof(TitleBar), new PropertyMetadata(850));
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="AutoConfigureCustomTitleBar"/> property.
/// </summary>
public static readonly DependencyProperty AutoConfigureCustomTitleBarProperty = DependencyProperty.Register(nameof(AutoConfigureCustomTitleBar), typeof(bool), typeof(TitleBar), new PropertyMetadata(true, AutoConfigureCustomTitleBarChanged));
/// <summary>
/// The backing <see cref="DependencyProperty"/> for the <see cref="Window"/> property.
/// </summary>
public static readonly DependencyProperty WindowProperty = DependencyProperty.Register(nameof(Window), typeof(Window), typeof(TitleBar), new PropertyMetadata(null));
/// <summary>
/// The event that gets fired when the back button is clicked
/// </summary>
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
public event EventHandler<RoutedEventArgs>? BackButtonClick;
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
/// <summary>
/// The event that gets fired when the pane toggle button is clicked
/// </summary>
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
public event EventHandler<RoutedEventArgs>? PaneButtonClick;
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
/// <summary>
/// Gets or sets the Icon
/// </summary>
public IconElement Icon
{
get => (IconElement)GetValue(IconProperty);
set => SetValue(IconProperty, value);
}
/// <summary>
/// Gets or sets the Title
/// </summary>
public string Title
{
get => (string)GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
/// <summary>
/// Gets or sets the Subtitle
/// </summary>
public string Subtitle
{
get => (string)GetValue(SubtitleProperty);
set => SetValue(SubtitleProperty, value);
}
/// <summary>
/// Gets or sets the content shown at the center of the TitleBar. When setting this, using DisplayMode=Tall is recommended.
/// </summary>
public object Content
{
get => (object)GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
/// <summary>
/// Gets or sets the content shown at the right of the TitleBar, next to the caption buttons. When setting this, using DisplayMode=Tall is recommended.
/// </summary>
public object Footer
{
get => (object)GetValue(FooterProperty);
set => SetValue(FooterProperty, value);
}
/// <summary>
/// Gets or sets DisplayMode. Compact is default (32px), Tall is recommended when setting the Content or Footer.
/// </summary>
public DisplayMode DisplayMode
{
get => (DisplayMode)GetValue(DisplayModeProperty);
set => SetValue(DisplayModeProperty, value);
}
/// <summary>
/// Gets or sets a value indicating whether gets or sets the visibility of the back button.
/// </summary>
public bool IsBackButtonVisible
{
get => (bool)GetValue(IsBackButtonVisibleProperty);
set => SetValue(IsBackButtonVisibleProperty, value);
}
/// <summary>
/// Gets or sets a value indicating whether gets or sets the visibility of the pane toggle button.
/// </summary>
public bool IsPaneButtonVisible
{
get => (bool)GetValue(IsPaneButtonVisibleProperty);
set => SetValue(IsPaneButtonVisibleProperty, value);
}
/// <summary>
/// Gets or sets the breakpoint of when the compact state is triggered.
/// </summary>
public int CompactStateBreakpoint
{
get => (int)GetValue(CompactStateBreakpointProperty);
set => SetValue(CompactStateBreakpointProperty, value);
}
/// <summary>
/// Gets or sets a value indicating whether gets or sets if the TitleBar should auto configure ExtendContentIntoTitleBar and CaptionButton background colors.
/// </summary>
public bool AutoConfigureCustomTitleBar
{
get => (bool)GetValue(AutoConfigureCustomTitleBarProperty);
set => SetValue(AutoConfigureCustomTitleBarProperty, value);
}
/// <summary>
/// Gets or sets the window the TitleBar should configure.
/// </summary>
public Window Window
{
get => (Window)GetValue(WindowProperty);
set => SetValue(WindowProperty, value);
}
private static void IsBackButtonVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((TitleBar)d).Update();
}
private static void IsPaneButtonVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((TitleBar)d).Update();
}
private static void DisplayModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((TitleBar)d).Update();
}
private static void ContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((TitleBar)d).Update();
}
private static void FooterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((TitleBar)d).Update();
}
private static void IconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((TitleBar)d).Update();
}
private static void AutoConfigureCustomTitleBarChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (((TitleBar)d).AutoConfigureCustomTitleBar)
{
((TitleBar)d).Configure();
}
else
{
((TitleBar)d).Reset();
}
}
}
public enum DisplayMode
{
Standard,
Tall,
}

View File

@@ -0,0 +1,195 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.UI;
using Microsoft.UI.Input;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using Windows.Foundation;
using Windows.Graphics;
namespace Microsoft.PowerToys.Settings.UI.Controls;
[TemplatePart(Name = nameof(PART_FooterPresenter), Type = typeof(ContentPresenter))]
[TemplatePart(Name = nameof(PART_ContentPresenter), Type = typeof(ContentPresenter))]
public partial class TitleBar : Control
{
#pragma warning disable SA1306 // Field names should begin with lower-case letter
#pragma warning disable SA1310 // Field names should not contain underscore
#pragma warning disable SA1400 // Access modifier should be declared
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
ContentPresenter? PART_ContentPresenter;
ContentPresenter? PART_FooterPresenter;
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
#pragma warning restore SA1400 // Access modifier should be declared
#pragma warning restore SA1306 // Field names should begin with lower-case letter
#pragma warning restore SA1310 // Field names should not contain underscore
private void SetWASDKTitleBar()
{
if (this.Window == null)
{
return;
}
if (AutoConfigureCustomTitleBar)
{
Window.AppWindow.TitleBar.ExtendsContentIntoTitleBar = true;
this.Window.SizeChanged -= Window_SizeChanged;
this.Window.SizeChanged += Window_SizeChanged;
this.Window.Activated -= Window_Activated;
this.Window.Activated += Window_Activated;
if (Window.Content is FrameworkElement rootElement)
{
UpdateCaptionButtons(rootElement);
rootElement.ActualThemeChanged += (s, e) =>
{
UpdateCaptionButtons(rootElement);
};
}
PART_ContentPresenter = GetTemplateChild(nameof(PART_ContentPresenter)) as ContentPresenter;
PART_FooterPresenter = GetTemplateChild(nameof(PART_FooterPresenter)) as ContentPresenter;
// Get caption button occlusion information.
int captionButtonOcclusionWidthRight = Window.AppWindow.TitleBar.RightInset;
int captionButtonOcclusionWidthLeft = Window.AppWindow.TitleBar.LeftInset;
PART_LeftPaddingColumn!.Width = new GridLength(captionButtonOcclusionWidthLeft);
PART_RightPaddingColumn!.Width = new GridLength(captionButtonOcclusionWidthRight);
if (DisplayMode == DisplayMode.Tall)
{
// Choose a tall title bar to provide more room for interactive elements
// like search box or person picture controls.
Window.AppWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Tall;
}
else
{
Window.AppWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Standard;
}
// Recalculate the drag region for the custom title bar
// if you explicitly defined new draggable areas.
SetDragRegionForCustomTitleBar();
_isAutoConfigCompleted = true;
}
}
private void Window_SizeChanged(object sender, WindowSizeChangedEventArgs args)
{
UpdateVisualStateAndDragRegion(args.Size);
}
private void UpdateCaptionButtons(FrameworkElement rootElement)
{
Window.AppWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent;
Window.AppWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
if (rootElement.ActualTheme == ElementTheme.Dark)
{
Window.AppWindow.TitleBar.ButtonForegroundColor = Colors.White;
Window.AppWindow.TitleBar.ButtonInactiveForegroundColor = Colors.DarkGray;
}
else
{
Window.AppWindow.TitleBar.ButtonForegroundColor = Colors.Black;
Window.AppWindow.TitleBar.ButtonInactiveForegroundColor = Colors.DarkGray;
}
}
private void ResetWASDKTitleBar()
{
if (this.Window == null)
{
return;
}
// Only reset if we were the ones who configured
if (_isAutoConfigCompleted)
{
Window.AppWindow.TitleBar.ExtendsContentIntoTitleBar = false;
this.Window.SizeChanged -= Window_SizeChanged;
this.Window.Activated -= Window_Activated;
SizeChanged -= this.TitleBar_SizeChanged;
Window.AppWindow.TitleBar.ResetToDefault();
}
}
private void Window_Activated(object sender, WindowActivatedEventArgs args)
{
if (args.WindowActivationState == WindowActivationState.Deactivated)
{
VisualStateManager.GoToState(this, WindowDeactivatedState, true);
}
else
{
VisualStateManager.GoToState(this, WindowActivatedState, true);
}
}
public void SetDragRegionForCustomTitleBar()
{
if (AutoConfigureCustomTitleBar && Window is not null)
{
ClearDragRegions(NonClientRegionKind.Passthrough);
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
var items = new FrameworkElement?[] { PART_ContentPresenter, PART_FooterPresenter, PART_ButtonHolder };
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
var validItems = items.Where(x => x is not null).Select(x => x!).ToArray(); // Prune null items
SetDragRegion(NonClientRegionKind.Passthrough, validItems);
}
}
public double GetRasterizationScaleForElement(UIElement element)
{
if (element.XamlRoot != null)
{
return element.XamlRoot.RasterizationScale;
}
return 0.0;
}
public void SetDragRegion(NonClientRegionKind nonClientRegionKind, params FrameworkElement[] frameworkElements)
{
List<RectInt32> rects = new List<RectInt32>();
var scale = GetRasterizationScaleForElement(this);
foreach (var frameworkElement in frameworkElements)
{
if (frameworkElement == null)
{
continue;
}
GeneralTransform transformElement = frameworkElement.TransformToVisual(null);
Rect bounds = transformElement.TransformBounds(new Rect(0, 0, frameworkElement.ActualWidth, frameworkElement.ActualHeight));
var transparentRect = new RectInt32(
_X: (int)Math.Round(bounds.X * scale),
_Y: (int)Math.Round(bounds.Y * scale),
_Width: (int)Math.Round(bounds.Width * scale),
_Height: (int)Math.Round(bounds.Height * scale));
rects.Add(transparentRect);
}
if (rects.Count > 0)
{
InputNonClientPointerSource.GetForWindowId(Window.AppWindow.Id).SetRegionRects(nonClientRegionKind, rects.ToArray());
}
}
public void ClearDragRegions(NonClientRegionKind nonClientRegionKind)
{
InputNonClientPointerSource.GetForWindowId(Window.AppWindow.Id).ClearRegionRects(nonClientRegionKind);
}
}

View File

@@ -0,0 +1,220 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Windows.Foundation;
namespace Microsoft.PowerToys.Settings.UI.Controls;
[TemplateVisualState(Name = BackButtonVisibleState, GroupName = BackButtonStates)]
[TemplateVisualState(Name = BackButtonCollapsedState, GroupName = BackButtonStates)]
[TemplateVisualState(Name = PaneButtonVisibleState, GroupName = PaneButtonStates)]
[TemplateVisualState(Name = PaneButtonCollapsedState, GroupName = PaneButtonStates)]
[TemplateVisualState(Name = WindowActivatedState, GroupName = ActivationStates)]
[TemplateVisualState(Name = WindowDeactivatedState, GroupName = ActivationStates)]
[TemplateVisualState(Name = StandardState, GroupName = DisplayModeStates)]
[TemplateVisualState(Name = TallState, GroupName = DisplayModeStates)]
[TemplateVisualState(Name = IconVisibleState, GroupName = IconStates)]
[TemplateVisualState(Name = IconCollapsedState, GroupName = IconStates)]
[TemplateVisualState(Name = ContentVisibleState, GroupName = ContentStates)]
[TemplateVisualState(Name = ContentCollapsedState, GroupName = ContentStates)]
[TemplateVisualState(Name = FooterVisibleState, GroupName = FooterStates)]
[TemplateVisualState(Name = FooterCollapsedState, GroupName = FooterStates)]
[TemplateVisualState(Name = WideState, GroupName = ReflowStates)]
[TemplateVisualState(Name = NarrowState, GroupName = ReflowStates)]
[TemplatePart(Name = PartBackButton, Type = typeof(Button))]
[TemplatePart(Name = PartPaneButton, Type = typeof(Button))]
[TemplatePart(Name = nameof(PART_LeftPaddingColumn), Type = typeof(ColumnDefinition))]
[TemplatePart(Name = nameof(PART_RightPaddingColumn), Type = typeof(ColumnDefinition))]
[TemplatePart(Name = nameof(PART_ButtonHolder), Type = typeof(StackPanel))]
public partial class TitleBar : Control
{
private const string PartBackButton = "PART_BackButton";
private const string PartPaneButton = "PART_PaneButton";
private const string BackButtonVisibleState = "BackButtonVisible";
private const string BackButtonCollapsedState = "BackButtonCollapsed";
private const string BackButtonStates = "BackButtonStates";
private const string PaneButtonVisibleState = "PaneButtonVisible";
private const string PaneButtonCollapsedState = "PaneButtonCollapsed";
private const string PaneButtonStates = "PaneButtonStates";
private const string WindowActivatedState = "Activated";
private const string WindowDeactivatedState = "Deactivated";
private const string ActivationStates = "WindowActivationStates";
private const string IconVisibleState = "IconVisible";
private const string IconCollapsedState = "IconCollapsed";
private const string IconStates = "IconStates";
private const string StandardState = "Standard";
private const string TallState = "Tall";
private const string DisplayModeStates = "DisplayModeStates";
private const string ContentVisibleState = "ContentVisible";
private const string ContentCollapsedState = "ContentCollapsed";
private const string ContentStates = "ContentStates";
private const string FooterVisibleState = "FooterVisible";
private const string FooterCollapsedState = "FooterCollapsed";
private const string FooterStates = "FooterStates";
private const string WideState = "Wide";
private const string NarrowState = "Narrow";
private const string ReflowStates = "ReflowStates";
#pragma warning disable SA1306 // Field names should begin with lower-case letter
#pragma warning disable SA1310 // Field names should not contain underscore
#pragma warning disable SA1400 // Access modifier should be declared
#pragma warning disable CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
ColumnDefinition? PART_RightPaddingColumn;
ColumnDefinition? PART_LeftPaddingColumn;
StackPanel? PART_ButtonHolder;
#pragma warning restore CS8632 // The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
#pragma warning restore SA1400 // Access modifier should be declared
#pragma warning restore SA1306 // Field names should begin with lower-case letter
#pragma warning restore SA1310 // Field names should not contain underscore
// We only want to reset TitleBar configuration in app, if we're the TitleBar instance that's managing that state.
private bool _isAutoConfigCompleted;
public TitleBar()
{
this.DefaultStyleKey = typeof(TitleBar);
}
protected override void OnApplyTemplate()
{
PART_LeftPaddingColumn = GetTemplateChild(nameof(PART_LeftPaddingColumn)) as ColumnDefinition;
PART_RightPaddingColumn = GetTemplateChild(nameof(PART_RightPaddingColumn)) as ColumnDefinition;
ConfigureButtonHolder();
Configure();
if (GetTemplateChild(PartBackButton) is Button backButton)
{
backButton.Click -= BackButton_Click;
backButton.Click += BackButton_Click;
}
if (GetTemplateChild(PartPaneButton) is Button paneButton)
{
paneButton.Click -= PaneButton_Click;
paneButton.Click += PaneButton_Click;
}
SizeChanged -= this.TitleBar_SizeChanged;
SizeChanged += this.TitleBar_SizeChanged;
Update();
base.OnApplyTemplate();
}
private void TitleBar_SizeChanged(object sender, SizeChangedEventArgs e)
{
UpdateVisualStateAndDragRegion(e.NewSize);
}
private void UpdateVisualStateAndDragRegion(Size size)
{
if (size.Width <= CompactStateBreakpoint)
{
if (Content != null || Footer != null)
{
VisualStateManager.GoToState(this, NarrowState, true);
}
}
else
{
VisualStateManager.GoToState(this, WideState, true);
}
SetDragRegionForCustomTitleBar();
}
private void BackButton_Click(object sender, RoutedEventArgs e)
{
BackButtonClick?.Invoke(this, new RoutedEventArgs());
}
private void PaneButton_Click(object sender, RoutedEventArgs e)
{
PaneButtonClick?.Invoke(this, new RoutedEventArgs());
}
private void ConfigureButtonHolder()
{
if (PART_ButtonHolder != null)
{
PART_ButtonHolder.SizeChanged -= PART_ButtonHolder_SizeChanged;
}
PART_ButtonHolder = GetTemplateChild(nameof(PART_ButtonHolder)) as StackPanel;
if (PART_ButtonHolder != null)
{
PART_ButtonHolder.SizeChanged += PART_ButtonHolder_SizeChanged;
}
}
private void PART_ButtonHolder_SizeChanged(object sender, SizeChangedEventArgs e)
{
SetDragRegionForCustomTitleBar();
}
private void Configure()
{
SetWASDKTitleBar();
}
public void Reset()
{
ResetWASDKTitleBar();
}
private void Update()
{
if (Icon != null)
{
VisualStateManager.GoToState(this, IconVisibleState, true);
}
else
{
VisualStateManager.GoToState(this, IconCollapsedState, true);
}
VisualStateManager.GoToState(this, IsBackButtonVisible ? BackButtonVisibleState : BackButtonCollapsedState, true);
VisualStateManager.GoToState(this, IsPaneButtonVisible ? PaneButtonVisibleState : PaneButtonCollapsedState, true);
if (DisplayMode == DisplayMode.Tall)
{
VisualStateManager.GoToState(this, TallState, true);
}
else
{
VisualStateManager.GoToState(this, StandardState, true);
}
if (Content != null)
{
VisualStateManager.GoToState(this, ContentVisibleState, true);
}
else
{
VisualStateManager.GoToState(this, ContentCollapsedState, true);
}
if (Footer != null)
{
VisualStateManager.GoToState(this, FooterVisibleState, true);
}
else
{
VisualStateManager.GoToState(this, FooterCollapsedState, true);
}
SetDragRegionForCustomTitleBar();
}
}

View File

@@ -0,0 +1,371 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls">
<x:Double x:Key="TitleBarCompactHeight">32</x:Double>
<x:Double x:Key="TitleBarTallHeight">48</x:Double>
<x:Double x:Key="TitleBarContentMinWidth">360</x:Double>
<Style BasedOn="{StaticResource DefaultTitleBarStyle}" TargetType="local:TitleBar" />
<Style x:Key="DefaultTitleBarStyle" TargetType="local:TitleBar">
<Setter Property="MinHeight" Value="{ThemeResource TitleBarCompactHeight}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:TitleBar">
<Grid
x:Name="PART_RootGrid"
Height="{TemplateBinding MinHeight}"
Padding="4,0,0,0"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="PART_LeftPaddingColumn" Width="0" />
<ColumnDefinition x:Name="PART_ButtonsHolderColumn" Width="Auto" />
<ColumnDefinition x:Name="PART_IconColumn" Width="Auto" />
<ColumnDefinition x:Name="PART_TitleColumn" Width="Auto" />
<ColumnDefinition
x:Name="PART_LeftDragColumn"
Width="*"
MinWidth="4" />
<ColumnDefinition x:Name="PART_ContentColumn" Width="Auto" />
<ColumnDefinition
x:Name="PART_RightDragColumn"
Width="*"
MinWidth="4" />
<ColumnDefinition x:Name="PART_FooterColumn" Width="Auto" />
<ColumnDefinition x:Name="PART_RightPaddingColumn" Width="0" />
</Grid.ColumnDefinitions>
<Border
x:Name="PART_IconHolder"
Grid.Column="2"
Margin="12,0,0,0"
VerticalAlignment="Center">
<Viewbox
x:Name="PART_Icon"
MaxWidth="16"
MaxHeight="16">
<ContentPresenter
x:Name="PART_IconPresenter"
AutomationProperties.AccessibilityView="Raw"
Content="{TemplateBinding Icon}"
HighContrastAdjustment="None" />
</Viewbox>
</Border>
<StackPanel
x:Name="PART_TitleHolder"
Grid.Column="3"
Margin="16,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal"
Spacing="4">
<TextBlock
x:Name="PART_TitleText"
MinWidth="48"
Margin="0,0,0,1"
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{TemplateBinding Title}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
<TextBlock
x:Name="PART_SubtitleText"
MinWidth="48"
Margin="0,0,0,1"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{TemplateBinding Subtitle}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
</StackPanel>
<Grid
x:Name="PART_DragRegion"
Grid.Column="2"
Grid.ColumnSpan="6"
Background="Transparent" />
<StackPanel
x:Name="PART_ButtonHolder"
Grid.Column="1"
Orientation="Horizontal">
<Button
x:Name="PART_BackButton"
Style="{ThemeResource TitleBarBackButtonStyle}"
ToolTipService.ToolTip="Back" />
<Button
x:Name="PART_PaneButton"
Style="{StaticResource TitleBarPaneToggleButtonStyle}"
ToolTipService.ToolTip="Toggle menu" />
</StackPanel>
<ContentPresenter
x:Name="PART_ContentPresenter"
Grid.Column="5"
MinWidth="{ThemeResource TitleBarContentMinWidth}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
HorizontalContentAlignment="Stretch"
Content="{TemplateBinding Content}" />
<ContentPresenter
x:Name="PART_FooterPresenter"
Grid.Column="7"
Margin="4,0,8,0"
HorizontalContentAlignment="Right"
Content="{TemplateBinding Footer}" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="BackButtonStates">
<VisualState x:Name="BackButtonVisible" />
<VisualState x:Name="BackButtonCollapsed">
<VisualState.Setters>
<Setter Target="PART_BackButton.Visibility" Value="Collapsed" />
<Setter Target="PART_BackButton.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="PaneButtonStates">
<VisualState x:Name="PaneButtonVisible" />
<VisualState x:Name="PaneButtonCollapsed">
<VisualState.Setters>
<Setter Target="PART_PaneButton.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="IconStates">
<VisualState x:Name="IconVisible" />
<VisualState x:Name="IconCollapsed">
<VisualState.Setters>
<Setter Target="PART_IconHolder.Visibility" Value="Collapsed" />
<Setter Target="PART_TitleHolder.Margin" Value="4,0,0,0" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="ContentStates">
<VisualState x:Name="ContentVisible" />
<VisualState x:Name="ContentCollapsed">
<VisualState.Setters>
<Setter Target="PART_ContentPresenter.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FooterStates">
<VisualState x:Name="FooterVisible" />
<VisualState x:Name="FooterCollapsed">
<VisualState.Setters>
<Setter Target="PART_FooterPresenter.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="ReflowStates">
<VisualState x:Name="Wide" />
<VisualState x:Name="Narrow">
<VisualState.Setters>
<Setter Target="PART_TitleHolder.Visibility" Value="Collapsed" />
<Setter Target="PART_LeftDragColumn.Width" Value="Auto" />
<Setter Target="PART_RightDragColumn.Width" Value="Auto" />
<Setter Target="PART_RightDragColumn.MinWidth" Value="16" />
<Setter Target="PART_LeftDragColumn.MinWidth" Value="16" />
<Setter Target="PART_ContentColumn.Width" Value="*" />
<!-- Content can stretch now -->
<Setter Target="PART_ContentPresenter.MinWidth" Value="0" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="WindowActivationStates">
<VisualState x:Name="Activated" />
<VisualState x:Name="Deactivated">
<VisualState.Setters>
<Setter Target="PART_TitleText.Foreground" Value="{ThemeResource TextFillColorDisabledBrush}" />
<Setter Target="PART_SubtitleText.Foreground" Value="{ThemeResource TextFillColorDisabledBrush}" />
<Setter Target="PART_BackButton.IsEnabled" Value="False" />
<Setter Target="PART_PaneButton.IsEnabled" Value="False" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="DisplayModeStates">
<VisualState x:Name="Standard" />
<VisualState x:Name="Tall">
<VisualState.Setters>
<Setter Target="PART_RootGrid.MinHeight" Value="{ThemeResource TitleBarTallHeight}" />
<Setter Target="PART_RootGrid.Padding" Value="4" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Copy of WinUI NavigationBackButtonNormalStyle - cannot use it as it picks up the generic.xaml version, not the WinUI version -->
<Style x:Key="TitleBarBackButtonStyle" TargetType="Button">
<Setter Property="Background" Value="{ThemeResource NavigationViewBackButtonBackground}" />
<Setter Property="Foreground" Value="{ThemeResource NavigationViewItemForegroundChecked}" />
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="MaxHeight" Value="40" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
<Setter Property="Content" Value="&#xE72B;" />
<Setter Property="Padding" Value="12,4,12,4" />
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid
x:Name="RootGrid"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}">
<AnimatedIcon
x:Name="Content"
Width="16"
Height="16"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
AnimatedIcon.State="Normal"
AutomationProperties.AccessibilityView="Raw">
<animatedvisuals:AnimatedBackVisualSource />
<AnimatedIcon.FallbackIconSource>
<FontIconSource
FontFamily="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FontFamily}"
FontSize="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FontSize}"
Glyph="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}"
MirroredWhenRightToLeft="True" />
</AnimatedIcon.FallbackIconSource>
</AnimatedIcon>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonBackgroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<VisualState.Setters>
<Setter Target="Content.(AnimatedIcon.State)" Value="PointerOver" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonBackgroundPressed}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundPressed}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<VisualState.Setters>
<Setter Target="Content.(AnimatedIcon.State)" Value="Pressed" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Copy of WinUI PaneToggleButtonStyle - cannot use it as it picks up the generic.xaml version, not the WinUI version -->
<Style x:Key="TitleBarPaneToggleButtonStyle" TargetType="Button">
<Setter Property="Background" Value="{ThemeResource NavigationViewBackButtonBackground}" />
<Setter Property="Foreground" Value="{ThemeResource NavigationViewItemForegroundChecked}" />
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="MaxHeight" Value="40" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
<Setter Property="Content" Value="&#xE700;" />
<Setter Property="Padding" Value="12,4,12,4" />
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid
x:Name="RootGrid"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}">
<AnimatedIcon
x:Name="Content"
Width="16"
Height="16"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
AnimatedIcon.State="Normal"
AutomationProperties.AccessibilityView="Raw">
<animatedvisuals:AnimatedGlobalNavigationButtonVisualSource />
<AnimatedIcon.FallbackIconSource>
<FontIconSource
FontFamily="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FontFamily}"
FontSize="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FontSize}"
Glyph="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}"
MirroredWhenRightToLeft="True" />
</AnimatedIcon.FallbackIconSource>
</AnimatedIcon>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonBackgroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<VisualState.Setters>
<Setter Target="Content.(AnimatedIcon.State)" Value="PointerOver" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonBackgroundPressed}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundPressed}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<VisualState.Setters>
<Setter Target="Content.(AnimatedIcon.State)" Value="Pressed" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource NavigationViewButtonForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -24,6 +24,7 @@
<controls:SettingsGroup x:Uid="MouseUtils_MouseJump">
<tkcontrols:SettingsCard
x:Name="MouseUtilsEnableMouseJump"
x:Uid="MouseUtils_Enable_MouseJump"
HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseJump.png}"
IsEnabled="{x:Bind ViewModel.IsJumpEnabledGpoConfigured, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}">
@@ -42,6 +43,7 @@
</InfoBar>
<tkcontrols:SettingsCard
x:Name="MouseUtilsMouseJumpActivationShortcut"
x:Uid="MouseUtils_MouseJump_ActivationShortcut"
HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}"
IsEnabled="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=OneWay}">
@@ -126,6 +128,7 @@
</tkcontrols:SettingsCard>
<tkcontrols:SettingsExpander
x:Name="MouseUtilsMouseJumpAppearance"
x:Uid="MouseUtils_MouseJump_Appearance"
HeaderIcon="{ui:FontIcon Glyph=&#xEB3C;}"
IsEnabled="{x:Bind ViewModel.IsMouseJumpEnabled, Mode=OneWay}"

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.AdvancedPastePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -12,7 +12,7 @@
x:Name="RootPage"
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
@@ -38,7 +38,7 @@
</StackPanel>
</DataTemplate>
</ResourceDictionary>
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<Grid>
<controls:SettingsPageControl x:Uid="AdvancedPaste" ModuleImageSource="ms-appx:///Assets/Settings/Modules/AdvancedPaste.png">
<controls:SettingsPageControl.ModuleContent>
@@ -425,4 +425,4 @@
</StackPanel>
</ContentDialog>
</Grid>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -15,7 +15,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class AdvancedPastePage : NavigatablePage, IRefreshablePage
public sealed partial class AdvancedPastePage : NavigablePage, IRefreshablePage
{
private AdvancedPasteViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.AlwaysOnTopPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -136,4 +136,4 @@
<controls:PageLink x:Uid="LearnMore_AlwaysOnTop" Link="https://aka.ms/PowerToysOverview_AlwaysOnTop" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class AlwaysOnTopPage : NavigatablePage, IRefreshablePage
public sealed partial class AlwaysOnTopPage : NavigablePage, IRefreshablePage
{
private AlwaysOnTopViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.AwakePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -14,9 +14,9 @@
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<converters:AwakeModeToIntConverter x:Key="AwakeModeToIntConverter" />
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<controls:SettingsPageControl
x:Uid="Awake"
@@ -119,4 +119,4 @@
<controls:PageLink x:Uid="SecondaryLink_Awake" Link="https://awake.den.dev" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -17,7 +17,7 @@ using PowerToys.GPOWrapper;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class AwakePage : NavigatablePage, IRefreshablePage
public sealed partial class AwakePage : NavigablePage, IRefreshablePage
{
private readonly string _appName = "Awake";
private readonly SettingsUtils _settingsUtils;

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.CmdNotFoundPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -170,4 +170,4 @@
<controls:PageLink x:Uid="LearnMore_CmdNotFound" Link="https://aka.ms/PowerToysOverview_CmdNotFound" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -8,7 +8,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class CmdNotFoundPage : NavigatablePage
public sealed partial class CmdNotFoundPage : NavigablePage
{
private CmdNotFoundViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.CmdPalPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -52,4 +52,4 @@
<controls:PageLink x:Uid="LearnMore_CmdPal" Link="https://aka.ms/PowerToysOverview_CmdPal" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -13,7 +13,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class CmdPalPage : NavigatablePage, IRefreshablePage
public sealed partial class CmdPalPage : NavigablePage, IRefreshablePage
{
private CmdPalViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.ColorPickerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -232,4 +232,4 @@
<controls:PageLink Link="https://medium.com/@Niels9001/a-fluent-color-meter-for-powertoys-20407ededf0c" Text="Niels Laute's UX concept" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -15,7 +15,7 @@ using Microsoft.Windows.ApplicationModel.Resources;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class ColorPickerPage : NavigatablePage, IRefreshablePage
public sealed partial class ColorPickerPage : NavigablePage, IRefreshablePage
{
public ColorPickerViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.CropAndLockPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -66,4 +66,4 @@
<controls:PageLink Link="https://github.com/kevinguo305" Text="Kevin Guo" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class CropAndLockPage : NavigatablePage, IRefreshablePage
public sealed partial class CropAndLockPage : NavigablePage, IRefreshablePage
{
private CropAndLockViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.DashboardPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -14,7 +14,7 @@
AutomationProperties.LandmarkType="Main"
DataContext="DashboardViewModel"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<converters:ModuleItemTemplateSelector
x:Key="ModuleItemTemplateSelector"
ActivationTemplate="{StaticResource ModuleItemActivationTemplate}"
@@ -74,7 +74,7 @@
TextWrapping="WrapWholeWords" />
</Grid>
</DataTemplate>
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<Grid Margin="16,0,0,0" RowSpacing="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -363,4 +363,4 @@
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
/// <summary>
/// Dashboard Settings Page.
/// </summary>
public sealed partial class DashboardPage : NavigatablePage, IRefreshablePage
public sealed partial class DashboardPage : NavigablePage, IRefreshablePage
{
/// <summary>
/// Gets or sets view model.

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.EnvironmentVariablesPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -53,4 +53,4 @@
<controls:PageLink x:Uid="LearnMore_EnvironmentVariables" Link="https://aka.ms/PowerToysOverview_EnvironmentVariables" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class EnvironmentVariablesPage : NavigatablePage, IRefreshablePage
public sealed partial class EnvironmentVariablesPage : NavigablePage, IRefreshablePage
{
private EnvironmentVariablesViewModel ViewModel { get; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.FancyZonesPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -70,19 +70,19 @@
x:Uid="FancyZones_ZoneBehavior_GroupSettings"
IsExpanded="True">
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesShiftDragCheckBoxControlHeader" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_ShiftDragCheckBoxControl_Header" IsChecked="{x:Bind ViewModel.ShiftDrag, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesMouseDragCheckBoxControlHeader" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_MouseDragCheckBoxControl_Header" IsChecked="{x:Bind ViewModel.MouseSwitch, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesMouseMiddleClickSpanningMultipleZonesCheckBoxControlHeader" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_MouseMiddleClickSpanningMultipleZonesCheckBoxControl_Header" IsChecked="{x:Bind ViewModel.MouseMiddleClickSpanningMultipleZones, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesShowZonesOnAllMonitorsCheckBoxControl" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_ShowZonesOnAllMonitorsCheckBoxControl" IsChecked="{x:Bind ViewModel.ShowOnAllMonitors, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesSpanZonesAcrossMonitors" ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl x:Uid="FancyZones_SpanZonesAcrossMonitors" IsChecked="{x:Bind ViewModel.SpanZonesAcrossMonitors, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Name="FancyZonesOverlappingZones" x:Uid="FancyZones_OverlappingZones">
@@ -106,7 +106,7 @@
<ComboBoxItem x:Uid="FancyZones_Radio_Default_Theme" />
</ComboBox>
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesPreviewCard" ContentAlignment="Left">
<controls:FancyZonesPreviewControl
Width="192"
Height="108"
@@ -118,7 +118,7 @@
IsSystemTheme="{x:Bind ViewModel.SystemTheme, Mode=OneWay}"
ShowZoneNumber="{x:Bind Path=ViewModel.ShowZoneNumber, Mode=OneWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesShowZoneNumberCheckBoxControl" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_ShowZoneNumberCheckBoxControl" IsChecked="{x:Bind ViewModel.ShowZoneNumber, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Name="FancyZonesHighlightOpacity" x:Uid="FancyZones_HighlightOpacity">
@@ -164,28 +164,31 @@
x:Uid="FancyZones_WindowBehavior_GroupSettings"
IsExpanded="True">
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesDisplayOrWorkAreaChangeMoveWindowsCheckBoxControl" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_DisplayOrWorkAreaChangeMoveWindowsCheckBoxControl" IsChecked="{x:Bind ViewModel.DisplayOrWorkAreaChangeMoveWindows, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesZoneSetChangeMoveWindows" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_ZoneSetChangeMoveWindows" IsChecked="{x:Bind ViewModel.ZoneSetChangeMoveWindows, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesAppLastZoneMoveWindows" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_AppLastZoneMoveWindows" IsChecked="{x:Bind ViewModel.AppLastZoneMoveWindows, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesOpenWindowOnActiveMonitor" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_OpenWindowOnActiveMonitor" IsChecked="{x:Bind ViewModel.OpenWindowOnActiveMonitor, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesRestoreSize" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_RestoreSize" IsChecked="{x:Bind ViewModel.RestoreSize, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesMakeDraggedWindowTransparentCheckBoxControl" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_MakeDraggedWindowTransparentCheckBoxControl" IsChecked="{x:Bind ViewModel.MakeDraggedWindowsTransparent, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<tkcontrols:SettingsCard Name="FancyZonesAllowChildWindowSnap" ContentAlignment="Left">
<CheckBox x:Uid="FancyZones_AllowChildWindowSnap" IsChecked="{x:Bind ViewModel.AllowChildWindowSnap, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left" Visibility="{x:Bind ViewModel.Windows11, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
<tkcontrols:SettingsCard
Name="FancyZonesDisableRoundCornersOnWindowSnap"
ContentAlignment="Left"
Visibility="{x:Bind ViewModel.Windows11, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
<CheckBox x:Uid="FancyZones_DisableRoundCornersOnWindowSnap" IsChecked="{x:Bind ViewModel.DisableRoundCornersOnWindowSnap, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
@@ -199,7 +202,7 @@
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.WindowSwitching, Mode=TwoWay}" />
<tkcontrols:SettingsExpander.Items>
<!-- HACK: For some weird reason, a Shortcut Control is not working correctly if it's the first item in the expander, so we add an invisible card as the first one. -->
<tkcontrols:SettingsCard Visibility="Collapsed" />
<tkcontrols:SettingsCard Name="FancyZonesWindowSwitchingPlaceholder" Visibility="Collapsed" />
<tkcontrols:SettingsCard
Name="FancyZonesHotkeyNextTabControl"
x:Uid="FancyZones_HotkeyNextTabControl"
@@ -248,7 +251,10 @@
</ComboBoxItem>
</ComboBox>
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.SnapHotkeysCategoryEnabled, Mode=OneWay}">
<tkcontrols:SettingsCard
Name="FancyZonesMoveWindowsAcrossAllMonitorsCheckBoxControl"
ContentAlignment="Left"
IsEnabled="{x:Bind ViewModel.SnapHotkeysCategoryEnabled, Mode=OneWay}">
<CheckBox x:Uid="FancyZones_MoveWindowsAcrossAllMonitorsCheckBoxControl" IsChecked="{x:Bind ViewModel.MoveWindowsAcrossMonitors, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
@@ -262,7 +268,10 @@
HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}">
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.QuickLayoutSwitch, Mode=TwoWay}" />
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.QuickSwitchEnabled, Mode=OneWay}">
<tkcontrols:SettingsCard
Name="FancyZonesFlashZonesOnQuickSwitch"
ContentAlignment="Left"
IsEnabled="{x:Bind ViewModel.QuickSwitchEnabled, Mode=OneWay}">
<CheckBox x:Uid="FancyZones_FlashZonesOnQuickSwitch" IsChecked="{x:Bind ViewModel.FlashZonesOnQuickSwitch, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
@@ -277,7 +286,10 @@
HeaderIcon="{ui:FontIcon Glyph=&#xECE4;}"
IsExpanded="True">
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard HorizontalContentAlignment="Stretch" ContentAlignment="Vertical">
<tkcontrols:SettingsCard
Name="FancyZonesExcludeAppsTextBoxControl"
HorizontalContentAlignment="Stretch"
ContentAlignment="Vertical">
<TextBox
x:Uid="FancyZones_ExcludeApps_TextBoxControl"
MinWidth="240"
@@ -299,4 +311,4 @@
<controls:PageLink x:Uid="LearnMore_FancyZones" Link="https://aka.ms/PowerToysOverview_FancyZones" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class FancyZonesPage : NavigatablePage, IRefreshablePage
public sealed partial class FancyZonesPage : NavigablePage, IRefreshablePage
{
private FancyZonesViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.FileLocksmithPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -53,4 +53,4 @@
<controls:PageLink x:Uid="LearnMore_FileLocksmith" Link="https://aka.ms/PowerToysOverview_FileLocksmith" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class FileLocksmithPage : NavigatablePage, IRefreshablePage
public sealed partial class FileLocksmithPage : NavigablePage, IRefreshablePage
{
private FileLocksmithViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.GeneralPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -12,10 +12,10 @@
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<converters:UpdateStateToBoolConverter x:Key="UpdateStateToBoolConverter" />
<converters:StringToInfoBarSeverityConverter x:Key="StringToInfoBarSeverityConverter" />
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<controls:SettingsPageControl x:Uid="General" ModuleImageSource="ms-appx:///Assets/Settings/Modules/PT.png">
<controls:SettingsPageControl.ModuleContent>
@@ -517,4 +517,4 @@
<controls:PageLink x:Uid="OpenSource_Notice" Link="https://github.com/microsoft/PowerToys/blob/main/NOTICE.md" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -19,7 +19,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
/// <summary>
/// General Settings Page.
/// </summary>
public sealed partial class GeneralPage : NavigatablePage, IRefreshablePage
public sealed partial class GeneralPage : NavigablePage, IRefreshablePage
{
private static DateTime OkToHideBackupAndRestoreMessageTime { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.HostsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -86,4 +86,4 @@
<controls:PageLink x:Uid="LearnMore_Hosts" Link="https://aka.ms/PowerToysOverview_HostsFileEditor" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class HostsPage : NavigatablePage, IRefreshablePage
public sealed partial class HostsPage : NavigablePage, IRefreshablePage
{
private HostsViewModel ViewModel { get; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.ImageResizerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -14,7 +14,7 @@
x:Name="RootPage"
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<converters:ImageResizerFitToStringConverter x:Key="ImageResizerFitToStringConverter" />
<converters:ImageResizerFitToIntConverter x:Key="ImageResizerFitToIntConverter" />
<converters:ImageResizerUnitToStringConverter x:Key="ImageResizerUnitToStringConverter" />
@@ -27,7 +27,7 @@
x:Key="BoolToComboBoxIndexConverter"
FalseValue="1"
TrueValue="0" />
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<controls:SettingsPageControl x:Uid="ImageResizer" ModuleImageSource="ms-appx:///Assets/Settings/Modules/ImageResizer.png">
<controls:SettingsPageControl.ModuleContent>
<StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}">
@@ -303,4 +303,4 @@
<controls:PageLink Link="https://github.com/bricelam/ImageResizer/" Text="Brice Lambson's ImageResizer" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -14,7 +14,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class ImageResizerPage : NavigatablePage, IRefreshablePage
public sealed partial class ImageResizerPage : NavigablePage, IRefreshablePage
{
public ImageResizerViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.KeyboardManagerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -13,7 +13,7 @@
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<tkconverters:CollectionVisibilityConverter x:Key="CollectionVisibilityConverter" />
<Style x:Name="KeysListViewContainerStyle" TargetType="ListViewItem">
<Setter Property="IsTabStop" Value="False" />
@@ -51,7 +51,7 @@
Height="56">
</DataTemplate>-->
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<controls:SettingsPageControl x:Uid="KeyboardManager" ModuleImageSource="ms-appx:///Assets/Settings/Modules/KBM.png">
<controls:SettingsPageControl.ModuleContent>
@@ -235,4 +235,4 @@
<controls:PageLink x:Uid="LearnMore_KBM" Link="https://aka.ms/PowerToysOverview_KeyboardManager" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -18,7 +18,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class KeyboardManagerPage : NavigatablePage, IRefreshablePage
public sealed partial class KeyboardManagerPage : NavigablePage, IRefreshablePage
{
private const string PowerToyName = "Keyboard Manager";

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.MeasureToolPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -108,4 +108,4 @@
<controls:PageLink x:Uid="Attribution_Rooler" Link="https://github.com/peteblois/rooler" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class MeasureToolPage : NavigatablePage, IRefreshablePage
public sealed partial class MeasureToolPage : NavigablePage, IRefreshablePage
{
private MeasureToolViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.MouseUtilsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -13,13 +13,13 @@
xmlns:ui="using:CommunityToolkit.WinUI"
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<converters:IndexBitFieldToVisibilityConverter x:Key="IndexBitFieldToVisibilityConverter" />
<tkconverters:BoolToVisibilityConverter
x:Key="BoolToInvertedVisibilityConverter"
FalseValue="Visible"
TrueValue="Collapsed" />
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<controls:SettingsPageControl x:Uid="MouseUtils" ModuleImageSource="ms-appx:///Assets/Settings/Modules/MouseUtils.png">
<controls:SettingsPageControl.ModuleContent>
<StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical">
@@ -423,4 +423,4 @@
<controls:PageLink Link="https://michael-clayton.com/projects/fancymouse" Text="Michael Clayton's Mouse Jump (FancyMouse)" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -12,7 +12,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class MouseUtilsPage : NavigatablePage, IRefreshablePage
public sealed partial class MouseUtilsPage : NavigablePage, IRefreshablePage
{
private MouseUtilsViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.MouseWithoutBordersPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -11,13 +11,13 @@
xmlns:ui="using:CommunityToolkit.WinUI"
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<converters:BoolToVisibilityConverter x:Key="negativeBoolToVisibilityConverter" />
<converters:BoolToObjectConverter
x:Key="OneRowMatrixBoolToNumberOfRowsConverter"
FalseValue="2"
TrueValue="4" />
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<controls:SettingsPageControl x:Uid="MouseWithoutBorders" ModuleImageSource="ms-appx:///Assets/Settings/Modules/MouseWithoutBorders.png">
<controls:SettingsPageControl.ModuleContent>
<StackPanel Orientation="Vertical">
@@ -524,4 +524,4 @@
<controls:PageLink Link="https://github.com/microsoft/PowerToys/blob/main/COMMUNITY.md#mouse-without-borders-original-contributors" Text="Truong Do (Đỗ Đức Trường) and other original contributors" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -21,7 +21,7 @@ using static Microsoft.PowerToys.Settings.UI.ViewModels.MouseWithoutBordersViewM
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class MouseWithoutBordersPage : NavigatablePage, IRefreshablePage
public sealed partial class MouseWithoutBordersPage : NavigablePage, IRefreshablePage
{
private const string MouseWithoutBordersDragDropCheckString = "MWB Device Drag Drop";

View File

@@ -1,4 +1,4 @@
<helper:NavigatablePage
<helper:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.NewPlusPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -215,4 +215,4 @@
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</helper:NavigatablePage>
</helper:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class NewPlusPage : NavigatablePage, IRefreshablePage
public sealed partial class NewPlusPage : NavigablePage, IRefreshablePage
{
private NewPlusViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.PeekPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -104,4 +104,4 @@
<controls:PageLink x:Uid="LearnMore_Peek" Link="https://aka.ms/PowerToysOverview_Peek" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class PeekPage : NavigatablePage, IRefreshablePage
public sealed partial class PeekPage : NavigablePage, IRefreshablePage
{
private PeekViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerAccentPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -11,7 +11,7 @@
xmlns:ui="using:CommunityToolkit.WinUI"
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<CollectionViewSource
x:Name="LanguagesCustomViewSource"
IsSourceGrouped="True"
@@ -19,7 +19,7 @@
<DataTemplate x:Key="LanguageViewTemplate" x:DataType="Lib:PowerAccentLanguageModel">
<TextBlock Text="{x:Bind Language}" />
</DataTemplate>
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<controls:SettingsPageControl
x:Uid="QuickAccent"
@@ -241,4 +241,4 @@
<controls:PageLink Link="https://github.com/damienleroy/PowerAccent" Text="Damien Leroy's PowerAccent" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -11,7 +11,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class PowerAccentPage : NavigatablePage, IRefreshablePage
public sealed partial class PowerAccentPage : NavigablePage, IRefreshablePage
{
private PowerAccentViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -15,7 +15,7 @@
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<Style x:Key="OptionSeparator" TargetType="Rectangle">
<Setter Property="Height" Value="1" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
@@ -304,7 +304,7 @@
<DataTemplate x:Key="EmptyTemplate" x:DataType="viewModels:PluginAdditionalOptionViewModel">
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" />
</DataTemplate>
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<controls:SettingsPageControl x:Uid="PowerLauncher" ModuleImageSource="ms-appx:///Assets/Settings/Modules/Run.png">
<controls:SettingsPageControl.ModuleContent>
@@ -816,4 +816,4 @@
<controls:PageLink Link="https://github.com/betsegaw/windowwalker/" Text="Beta Tadele's Window Walker" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -15,7 +15,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class PowerLauncherPage : NavigatablePage, IRefreshablePage
public sealed partial class PowerLauncherPage : NavigablePage, IRefreshablePage
{
public PowerLauncherViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerOcrPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -79,4 +79,4 @@
<controls:PageLink Link="https://github.com/TheJoeFin/Text-Grab" Text="Based upon Joseph Finney's Text Grab" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class PowerOcrPage : NavigatablePage, IRefreshablePage
public sealed partial class PowerOcrPage : NavigablePage, IRefreshablePage
{
private PowerOcrViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerPreviewPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -289,4 +289,4 @@
<controls:PageLink Link="https://www.pedrolamas.com" Text="Pedro Lamas's work on G-Code, Binary G-Code, STL, and QOI" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -12,7 +12,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class PowerPreviewPage : NavigatablePage
public sealed partial class PowerPreviewPage : NavigablePage
{
public PowerPreviewViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerRenamePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -100,4 +100,4 @@
<controls:PageLink Link="https://github.com/chrdavis/SmartRename" Text="Chris Davis's SmartRenamer" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class PowerRenamePage : NavigatablePage, IRefreshablePage
public sealed partial class PowerRenamePage : NavigablePage, IRefreshablePage
{
private PowerRenameViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.RegistryPreviewPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -57,4 +57,4 @@
<controls:PageLink x:Uid="LearnMore_RegistryPreview" Link="https://aka.ms/PowerToysOverview_RegistryPreview" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -8,7 +8,7 @@ using Microsoft.PowerToys.Settings.UI.ViewModels;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class RegistryPreviewPage : NavigatablePage, IRefreshablePage
public sealed partial class RegistryPreviewPage : NavigablePage, IRefreshablePage
{
private RegistryPreviewViewModel ViewModel { get; set; }

View File

@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using CommunityToolkit.WinUI.Controls;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Services;
using Microsoft.PowerToys.Settings.UI.ViewModels;
@@ -32,7 +33,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
if (e.Parameter is SearchResultsNavigationParams searchParams)
{
ViewModel.SetSearchResults(searchParams.Query, searchParams.Results);
PageControl.ModuleDescription = string.Empty;
PageControl.ModuleDescription = $"{ResourceLoaderInstance.ResourceLoader.GetString("Search_ResultsFor")} '{searchParams.Query}'";
}
}
@@ -43,7 +44,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
private void ModuleButton_Click(object sender, RoutedEventArgs e)
{
if (sender is CommunityToolkit.WinUI.Controls.SettingsCard card && card.DataContext is SettingEntry tagEntry)
if (sender is SettingsCard card && card.DataContext is SettingEntry tagEntry)
{
NavigateToModule(tagEntry);
}
@@ -51,7 +52,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
private void SettingButton_Click(object sender, RoutedEventArgs e)
{
if (sender is CommunityToolkit.WinUI.Controls.SettingsCard card && card.DataContext is SettingEntry tagEntry)
if (sender is SettingsCard card && card.DataContext is SettingEntry tagEntry)
{
NavigateToSetting(tagEntry);
}

View File

@@ -4,6 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animatedVisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:animations="using:CommunityToolkit.WinUI.Animations"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="using:Microsoft.PowerToys.Settings.UI.Helpers"
@@ -11,7 +12,6 @@
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="using:Microsoft.PowerToys.Settings.UI.ViewModels"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
xmlns:ui="using:CommunityToolkit.WinUI"
xmlns:views="using:Microsoft.PowerToys.Settings.UI.Views"
@@ -57,12 +57,6 @@
</DataTemplate>
<DataTemplate x:Key="NoResultSearchResultTemplate" x:DataType="models:SuggestionItem">
<Grid>
<Rectangle
Height="1"
Margin="0,-4,0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Fill="{ThemeResource DividerStrokeColorDefaultBrush}" />
<TextBlock
Margin="8"
HorizontalAlignment="Center"
@@ -71,10 +65,10 @@
</Grid>
</DataTemplate>
<DataTemplate x:Key="ShowAllSearchResultTemplate" x:DataType="models:SuggestionItem">
<Grid Padding="16,8">
<Grid>
<Rectangle
Height="1"
Margin="0,-4,0,0"
Margin="0,-12,0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Fill="{ThemeResource DividerStrokeColorDefaultBrush}" />
@@ -92,23 +86,22 @@
<ic:InvokeCommandAction Command="{x:Bind ViewModel.LoadedCommand}" />
</ic:EventTriggerBehavior>
</i:Interaction.Behaviors>
<Grid x:Name="RootGrid">
<Grid.RowDefinitions>
<RowDefinition Height="48" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<tkcontrols:TitleBar
<controls:TitleBar
x:Name="AppTitleBar"
AutoConfigureCustomTitleBar="True"
PaneButtonClick="PaneToggleBtn_Click">
<tkcontrols:TitleBar.Resources>
<controls:TitleBar.Resources>
<x:Double x:Key="TitleBarContentMinWidth">516</x:Double>
</tkcontrols:TitleBar.Resources>
<tkcontrols:TitleBar.Icon>
</controls:TitleBar.Resources>
<controls:TitleBar.Icon>
<BitmapIcon ShowAsMonochrome="False" UriSource="/Assets/Settings/icon.ico" />
</tkcontrols:TitleBar.Icon>
<tkcontrols:TitleBar.Content>
</controls:TitleBar.Icon>
<controls:TitleBar.Content>
<AutoSuggestBox
x:Name="SearchBox"
x:Uid="Shell_SearchBox"
@@ -129,8 +122,8 @@
Modifiers="Control" />
</AutoSuggestBox.KeyboardAccelerators>
</AutoSuggestBox>
</tkcontrols:TitleBar.Content>
</tkcontrols:TitleBar>
</controls:TitleBar.Content>
</controls:TitleBar>
<NavigationView
x:Name="navigationView"
Grid.Row="1"

View File

@@ -4,13 +4,13 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Common.Search;
using Common.Search.FuzzSearch;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Controls;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Services;
@@ -132,7 +132,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
public static bool IsUserAnAdmin { get; set; }
public CommunityToolkit.WinUI.Controls.TitleBar TitleBar => AppTitleBar;
public Controls.TitleBar TitleBar => AppTitleBar;
private Dictionary<Type, NavigationViewItem> _navViewParentLookup = new Dictionary<Type, NavigationViewItem>();
private List<string> _searchSuggestions = [];
@@ -141,8 +141,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
private const int SearchDebounceMs = 500;
private bool _disposed;
// Tracing id for correlating logs of a single search interaction
private static long _searchTraceIdCounter;
// Removed trace id counter per cleanup
/// <summary>
/// Initializes a new instance of the <see cref="ShellPage"/> class.
@@ -442,25 +441,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
private void ShellPage_Loaded(object sender, RoutedEventArgs e)
{
Logger.LogDebug("[Search][Index] Scheduling BuildIndex...");
var swIndex = Stopwatch.StartNew();
Task.Run(() =>
{
Logger.LogDebug("[Search][Index] BuildIndex started");
SearchIndexService.BuildIndex();
})
.ContinueWith(t =>
{
swIndex.Stop();
if (t.IsFaulted)
{
Logger.LogDebug($"[Search][Index] BuildIndex FAILED after {swIndex.ElapsedMilliseconds} ms: {t.Exception?.Flatten().InnerException?.Message}");
}
else
{
Logger.LogDebug($"[Search][Index] BuildIndex completed in {swIndex.ElapsedMilliseconds} ms.");
}
});
.ContinueWith(_ => { });
}
private void NavigationView_DisplayModeChanged(NavigationView sender, NavigationViewDisplayModeChangedEventArgs args)
@@ -511,10 +496,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views
var query = sender.Text?.Trim() ?? string.Empty;
var traceId = Interlocked.Increment(ref _searchTraceIdCounter);
var swOverall = Stopwatch.StartNew();
Logger.LogDebug($"[Search][TextChanged][{traceId}] start. query='{query}'");
// Debounce: cancel previous pending search
_searchDebounceCts?.Cancel();
_searchDebounceCts?.Dispose();
@@ -527,7 +508,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views
sender.IsSuggestionListOpen = false;
_lastSearchResults.Clear();
_lastQueryText = string.Empty;
Logger.LogDebug($"[Search][TextChanged][{traceId}] empty query. end");
return;
}
@@ -537,14 +517,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
}
catch (TaskCanceledException)
{
// A newer keystroke arrived; abandon this run
Logger.LogDebug($"[Search][TextChanged][{traceId}] debounce canceled at +{swOverall.ElapsedMilliseconds} ms");
return;
return; // debounce canceled
}
if (token.IsCancellationRequested)
{
Logger.LogDebug($"[Search][TextChanged][{traceId}] token canceled post-debounce at +{swOverall.ElapsedMilliseconds} ms");
return;
}
@@ -553,106 +530,25 @@ namespace Microsoft.PowerToys.Settings.UI.Views
try
{
// If the token is already canceled before scheduling, the task won't start.
var swSearch = Stopwatch.StartNew();
Logger.LogDebug($"[Search][TextChanged][{traceId}] dispatch search...");
results = await Task.Run(() => SearchIndexService.Search(query, token), token);
swSearch.Stop();
Logger.LogDebug($"[Search][TextChanged][{traceId}] search done in {swSearch.ElapsedMilliseconds} ms. results={results?.Count ?? 0}");
}
catch (OperationCanceledException)
{
Logger.LogDebug($"[Search][TextChanged][{traceId}] search canceled at +{swOverall.ElapsedMilliseconds} ms");
return;
}
if (token.IsCancellationRequested)
{
Logger.LogDebug($"[Search][TextChanged][{traceId}] token canceled after search at +{swOverall.ElapsedMilliseconds} ms");
return;
}
_lastSearchResults = results;
_lastQueryText = query;
List<SuggestionItem> top;
if (results.Count == 0)
{
// Explicit no-results row
var rl = ResourceLoaderInstance.ResourceLoader;
var noResultsPrefix = rl.GetString("Shell_Search_NoResults");
if (string.IsNullOrEmpty(noResultsPrefix))
{
noResultsPrefix = "No results for";
}
var top = BuildSuggestionItems(query, results);
var headerText = $"{noResultsPrefix} '{query}'";
top =
[
new()
{
Header = headerText,
IsNoResults = true,
},
];
Logger.LogDebug($"[Search][TextChanged][{traceId}] no results -> added placeholder item (count={top.Count})");
}
else
{
// Project top 5 suggestions
var swProject = Stopwatch.StartNew();
top = [.. results.Take(5)
.Select(e =>
{
string subtitle = string.Empty;
if (e.Type != EntryType.SettingsPage)
{
var swSubtitle = Stopwatch.StartNew();
subtitle = SearchIndexService.GetLocalizedPageName(e.PageTypeName);
if (string.IsNullOrEmpty(subtitle))
{
// Fallback: look up the module title from the in-memory index
var swFallback = Stopwatch.StartNew();
subtitle = SearchIndexService.Index
.Where(x => x.Type == EntryType.SettingsPage && x.PageTypeName == e.PageTypeName)
.Select(x => x.Header)
.FirstOrDefault() ?? string.Empty;
swFallback.Stop();
Logger.LogDebug($"[Search][TextChanged][{traceId}] fallback subtitle for '{e.PageTypeName}' took {swFallback.ElapsedMilliseconds} ms");
}
swSubtitle.Stop();
Logger.LogDebug($"[Search][TextChanged][{traceId}] subtitle for '{e.PageTypeName}' took {swSubtitle.ElapsedMilliseconds} ms");
}
return new SuggestionItem
{
Header = e.Header,
Icon = e.Icon,
PageTypeName = e.PageTypeName,
ElementName = e.ElementName,
ParentElementName = e.ParentElementName,
Subtitle = subtitle,
IsShowAll = false,
};
})];
swProject.Stop();
Logger.LogDebug($"[Search][TextChanged][{traceId}] project suggestions took {swProject.ElapsedMilliseconds} ms. topCount={top.Count}");
if (results.Count > 5)
{
// Add a tail item to show all results if there are more than 5
top.Add(new SuggestionItem { IsShowAll = true });
Logger.LogDebug($"[Search][TextChanged][{traceId}] added 'Show all results' item");
}
}
var swUi = Stopwatch.StartNew();
sender.ItemsSource = top;
sender.IsSuggestionListOpen = top.Count > 0;
swUi.Stop();
swOverall.Stop();
Logger.LogDebug($"[Search][TextChanged][{traceId}] UI update took {swUi.ElapsedMilliseconds} ms. total={swOverall.ElapsedMilliseconds} ms");
}
private void SearchBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
@@ -709,23 +605,98 @@ namespace Microsoft.PowerToys.Settings.UI.Views
private void CtrlF_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
{
SearchBox.Focus(FocusState.Programmatic);
args.Handled = true; // prevent further processing (e.g., unintended navigation)
}
private void SearchBox_GotFocus(object sender, RoutedEventArgs e)
{
// do not prompt unless search for text.
return;
var box = sender as AutoSuggestBox;
var current = box?.Text?.Trim() ?? string.Empty;
if (string.IsNullOrEmpty(current))
{
return; // nothing to restore
}
// If current text matches last query and we have results, reconstruct the suggestion list.
if (string.Equals(current, _lastQueryText, StringComparison.Ordinal) && _lastSearchResults?.Count > 0)
{
try
{
var top = BuildSuggestionItems(current, _lastSearchResults);
box.ItemsSource = top;
box.IsSuggestionListOpen = top.Count > 0;
}
catch (Exception ex)
{
Logger.LogError($"Error restoring suggestion list {ex.Message}");
}
}
}
// Centralized suggestion projection logic used by TextChanged & GotFocus restore.
private List<SuggestionItem> BuildSuggestionItems(string query, List<SettingEntry> results)
{
results ??= new();
if (results.Count == 0)
{
var rl = ResourceLoaderInstance.ResourceLoader;
var noResultsPrefix = rl.GetString("Shell_Search_NoResults");
if (string.IsNullOrEmpty(noResultsPrefix))
{
noResultsPrefix = "No results for";
}
var headerText = $"{noResultsPrefix} '{query}'";
return new List<SuggestionItem>
{
new()
{
Header = headerText,
IsNoResults = true,
},
};
}
var list = results.Take(5).Select(e =>
{
string subtitle = string.Empty;
if (e.Type != EntryType.SettingsPage)
{
subtitle = SearchIndexService.GetLocalizedPageName(e.PageTypeName);
if (string.IsNullOrEmpty(subtitle))
{
subtitle = SearchIndexService.Index
.Where(x => x.Type == EntryType.SettingsPage && x.PageTypeName == e.PageTypeName)
.Select(x => x.Header)
.FirstOrDefault() ?? string.Empty;
}
}
return new SuggestionItem
{
Header = e.Header,
Icon = e.Icon,
PageTypeName = e.PageTypeName,
ElementName = e.ElementName,
ParentElementName = e.ParentElementName,
Subtitle = subtitle,
IsShowAll = false,
};
}).ToList();
if (results.Count > 5)
{
list.Add(new SuggestionItem { IsShowAll = true });
}
return list;
}
private async void SearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
var swSubmit = Stopwatch.StartNew();
Logger.LogDebug("[Search][Submit] start");
// If a suggestion is selected, navigate directly
if (args.ChosenSuggestion is SuggestionItem chosen)
{
Logger.LogDebug($"[Search][Submit] chosen suggestion -> navigate to {chosen.PageTypeName} element={chosen.ElementName ?? "<page>"}");
NavigateFromSuggestion(chosen);
return;
}
@@ -733,7 +704,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views
var queryText = (args.QueryText ?? _lastQueryText)?.Trim();
if (string.IsNullOrWhiteSpace(queryText))
{
Logger.LogDebug("[Search][Submit] empty query -> navigate Dashboard");
NavigationService.Navigate<DashboardPage>();
return;
}
@@ -741,21 +711,10 @@ namespace Microsoft.PowerToys.Settings.UI.Views
// Prefer cached results (from live search); if empty, perform a fresh search
var matched = _lastSearchResults?.Count > 0 && string.Equals(_lastQueryText, queryText, StringComparison.Ordinal)
? _lastSearchResults
: await Task.Run(() =>
{
var sw = Stopwatch.StartNew();
Logger.LogDebug($"[Search][Submit] background search for '{queryText}'...");
var r = SearchIndexService.Search(queryText);
sw.Stop();
Logger.LogDebug($"[Search][Submit] background search done in {sw.ElapsedMilliseconds} ms. results={r?.Count ?? 0}");
return r;
});
: await Task.Run(() => SearchIndexService.Search(queryText));
var searchParams = new SearchResultsNavigationParams(queryText, matched);
Logger.LogDebug($"[Search][Submit] navigate to SearchResultsPage (results={matched?.Count ?? 0})");
NavigationService.Navigate<SearchResultsPage>(searchParams);
swSubmit.Stop();
Logger.LogDebug($"[Search][Submit] total {swSubmit.ElapsedMilliseconds} ms");
}
public void Dispose()

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.ShortcutGuidePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -136,4 +136,4 @@
<controls:PageLink x:Uid="LearnMore_ShortcutGuide" Link="https://aka.ms/PowerToysOverview_ShortcutGuide" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class ShortcutGuidePage : NavigatablePage, IRefreshablePage
public sealed partial class ShortcutGuidePage : NavigablePage, IRefreshablePage
{
private ShortcutGuideViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.WorkspacesPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -57,4 +57,4 @@
<controls:PageLink x:Uid="LearnMore_Workspaces" Link="https://aka.ms/PowerToysOverview_Workspaces" />
</controls:SettingsPageControl.PrimaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class WorkspacesPage : NavigatablePage, IRefreshablePage
public sealed partial class WorkspacesPage : NavigablePage, IRefreshablePage
{
private WorkspacesViewModel ViewModel { get; set; }

View File

@@ -1,4 +1,4 @@
<local:NavigatablePage
<local:NavigablePage
x:Class="Microsoft.PowerToys.Settings.UI.Views.ZoomItPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -12,10 +12,10 @@
AutomationProperties.LandmarkType="Main"
mc:Ignorable="d">
<local:NavigatablePage.Resources>
<local:NavigablePage.Resources>
<converters:ZoomItInitialZoomConverter x:Key="ZoomItInitialZoomConverter" />
<converters:ZoomItTypeSpeedSliderConverter x:Key="ZoomItTypeSpeedSliderConverter" />
</local:NavigatablePage.Resources>
</local:NavigablePage.Resources>
<controls:SettingsPageControl
x:Uid="ZoomIt"
@@ -275,4 +275,4 @@
<controls:PageLink Link="https://learn.microsoft.com/en-us/sysinternals/downloads/zoomit" Text="Sysinternals Zoomit by Mark Russinovich, Alex Mihaiuc, John Stephens" />
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</local:NavigatablePage>
</local:NavigablePage>

View File

@@ -12,7 +12,7 @@ using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class ZoomItPage : NavigatablePage, IRefreshablePage
public sealed partial class ZoomItPage : NavigablePage, IRefreshablePage
{
private ZoomItViewModel ViewModel { get; set; }

View File

@@ -2691,6 +2691,12 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
<value>Shortcuts with **Ctrl** and **Alt** may remove functionality from some international keyboards, because **Ctrl** + **Alt** = **Alt Gr** in those keyboards.</value>
<comment>The ** sequences are used for text formatting of the key names. Don't remove them on translation.</comment>
</data>
<data name="WarningShortcutConflict.Title" xml:space="preserve">
<value>Shortcut conflict</value>
</data>
<data name="WarningShortcutConflict.ToolTipService.ToolTip" xml:space="preserve">
<value>A conflict has been detected for this shortcut.</value>
</data>
<data name="FancyZones_SpanZonesAcrossMonitors.Description" xml:space="preserve">
<value>All monitors must have the same DPI scaling and will be treated as one large combined rectangle which contains all monitors</value>
</data>
@@ -2896,20 +2902,19 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
<data name="MouseUtils_GlidingCursor.Description" xml:space="preserve">
<value>An accessibility feature that lets you control the mouse with a single button using guided horizontal and vertical lines</value>
</data>
<data name="MouseUtils_GlidingCursor_InitialSpeed.Header" xml:space="preserve">
<data name="MouseUtils_GlidingCursor_InitialSpeed.Header" xml:space="preserve">
<value>Initial line speed</value>
</data>
<data name="MouseUtils_GlidingCursor_InitialSpeed.Description" xml:space="preserve">
<data name="MouseUtils_GlidingCursor_InitialSpeed.Description" xml:space="preserve">
<value>Speed of the horizontal or vertical line when it begins moving</value>
</data>
<data name="MouseUtils_GlidingCursor_DelaySpeed.Header" xml:space="preserve">
<data name="MouseUtils_GlidingCursor_DelaySpeed.Header" xml:space="preserve">
<value>Reduced line speed</value>
</data>
<data name="MouseUtils_GlidingCursor_DelaySpeed.Description" xml:space="preserve">
<data name="MouseUtils_GlidingCursor_DelaySpeed.Description" xml:space="preserve">
<value>Speed after slowing down the line with a second shortcut press</value>
</data>
<data name="FancyZones_Radio_Custom_Colors.Content" xml:space="preserve">
<data name="FancyZones_Radio_Custom_Colors.Content" xml:space="preserve">
<value>Custom colors</value>
</data>
<data name="FancyZones_Radio_Default_Theme.Content" xml:space="preserve">
@@ -5266,7 +5271,7 @@ To record a specific window, enter the hotkey with the Alt key in the opposite m
<value>All shortcuts function correctly</value>
</data>
<data name="ResolveConflicts_Button.Content" xml:space="preserve">
<value>Resolve conflicts</value>
<value>Resolve conflicts</value>
</data>
<data name="ShortcutConflictControl_Title.Text" xml:space="preserve">
<value>Shortcut conflicts</value>
@@ -5287,4 +5292,8 @@ To record a specific window, enter the hotkey with the Alt key in the opposite m
<data name="Hosts_NoLeadingSpaces.Description" xml:space="preserve">
<value>Do not prepend spaces to active lines when saving the hosts file</value>
</data>
<data name="Search_ResultsFor" xml:space="preserve">
<value>Results for</value>
<comment>Prefix for search string. E.g. "Results for 'shortcut'"</comment>
</data>
</root>

View File

@@ -126,14 +126,21 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
var assembly = Assembly.GetExecutingAssembly();
var assemblyName = new AssemblyName(assembly.FullName ?? throw new InvalidOperationException());
// Build the fully-qualified manifest resource name. Historically, subtle casing differences
// (e.g. folder names or the assembly name) caused exact (case-sensitive) lookup failures on
// some developer machines when the embedded resource's actual name differed only by case.
// Manifest resource name comparison here does not need to be case-sensitive, so we resolve
// the actual name using an OrdinalIgnoreCase match, then use the real casing for the stream.
var resourceName = $"Microsoft.{assemblyName.Name}.{filename.Replace("/", ".")}";
var resourceNames = assembly.GetManifestResourceNames();
if (!resourceNames.Contains(resourceName))
var actualResourceName = resourceNames.FirstOrDefault(n => string.Equals(n, resourceName, StringComparison.OrdinalIgnoreCase));
if (actualResourceName is null)
{
throw new InvalidOperationException($"Embedded resource '{resourceName}' does not exist.");
throw new InvalidOperationException($"Embedded resource '{resourceName}' (case-insensitive) does not exist.");
}
var stream = assembly.GetManifestResourceStream(resourceName)
var stream = assembly.GetManifestResourceStream(actualResourceName)
?? throw new InvalidOperationException();
var image = (Bitmap)Image.FromStream(stream);
return image;

View File

@@ -145,6 +145,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
// Get current hotkey settings (fresh from file) using the accessor's getter
module.HotkeySettings = hotkeyAccessor.Value;
module.HotkeySettings.ConflictDescription = isSystemConflict
? ResourceLoaderInstance.ResourceLoader.GetString("SysHotkeyConflictTooltipText")
: ResourceLoaderInstance.ResourceLoader.GetString("InAppHotkeyConflictTooltipText");
// Set header using localization key
module.Header = GetHotkeyLocalizationHeader(module.ModuleName, module.HotkeyID, hotkeyAccessor.LocalizationHeaderKey);