CmdPal: Add configuration option for Escape key behavior (#43354)

## Summary of the Pull Request

This PR adds a new option to the **General** page in **Settings**:

Escape key behavior — a dropdown with the following choices:

- Clear search first, then go back
  - Current behavior.
  - If the search box contains text, it is cleared; otherwise goes back.
  - On the home page, CmdPal is dismissed.

- Go back
  - Leaves the search text intact.
- If the page is not transient, the search text reappears when
returning.
  - On the home page, CmdPal is dismissed.

- Hide window and go home (Always dismiss)
  - Immediately dismisses CmdPal and navigates to the home page.
  - Ignores the **Go home when activated** setting.
  - Search text is cleared.

- Hide window
  - Just hides the window.
  - Intended to be used with #43355.

This implementation preserves existing behavior, except for **Always
dismiss**, which always forces navigation to the home page.

## Pictures? Pictures!

<img width="1305" height="892" alt="image"
src="https://github.com/user-attachments/assets/562e5604-1da6-4fc6-8358-5053df9c573d"
/>


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

- [x] Closes: #38311
- [ ] **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 commit is contained in:
Jiří Polášek
2025-12-05 23:32:24 +01:00
committed by GitHub
parent 995a699de7
commit e68526b8d8
10 changed files with 93 additions and 22 deletions

View File

@@ -556,4 +556,22 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
<data name="Settings_PageTitles_ExtensionsPage" xml:space="preserve">
<value>Extensions</value>
</data>
<data name="Settings_GeneralPage_EscapeKeyBehavior_Option_DismissEmptySearchOrGoBack.Content" xml:space="preserve">
<value>Clear search first, then go back</value>
</data>
<data name="Settings_GeneralPage_EscapeKeyBehavior_Option_AlwaysGoBack.Content" xml:space="preserve">
<value>Go back</value>
</data>
<data name="Settings_GeneralPage_EscapeKeyBehavior_Option_AlwaysDismiss.Content" xml:space="preserve">
<value>Hide window and go home</value>
</data>
<data name="Settings_GeneralPage_EscapeKeyBehavior_Option_AlwaysHide.Content" xml:space="preserve">
<value>Hide window</value>
</data>
<data name="Settings_GeneralPage_EscapeKeyBehavior_SettingsCard.Header" xml:space="preserve">
<value>Escape key behavior</value>
</data>
<data name="Settings_GeneralPage_EscapeKeyBehavior_SettingsCard.Description" xml:space="preserve">
<value>Choose how Escape key behaves</value>
</data>
</root>