## Summary of the Pull Request https://github.com/user-attachments/assets/f4afdaf8-2830-4993-82ea-1ee9a6978e4c <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] Closes: Status: #890 #15405 #179 #129 #22419 #31289 #47297 #47464 #44816 - [x] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [x] **Localization:** All end-user-facing strings can be localized - [x] **Dev docs:** Added/updated - [x] **New binaries:** Added on the required places - [x] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [x] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [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) - [x] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: https://github.com/MicrosoftDocs/windows-dev-docs/pull/5717 <!-- 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 Work for future PRs: - [ ] Localization of built-in shortcut files - [ ] Further customization (we can wait on user feedback for that) - [ ] Reimplement holding windows key - [ ] Search bar <details> <summary>Images</summary> https://github.com/user-attachments/assets/f923daa4-d713-463b-ba33-ede72b986c12 <img width="726" height="1388" alt="image" src="https://github.com/user-attachments/assets/781eff9a-2863-44be-bbe2-25371ef8838e" /> <img width="624" height="351" alt="image" src="https://github.com/user-attachments/assets/ec8a44db-afbc-4e28-8285-ba2a9e345fb9" /> <img width="712" height="1086" alt="image" src="https://github.com/user-attachments/assets/5a3775fc-36e9-4971-8d3f-491e8f8da45a" /> <img width="726" height="134" alt="image" src="https://github.com/user-attachments/assets/7d0a8b1f-d10e-4466-820c-b3efdc5f3c84" /> </details> <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed --------- Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com> Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Muyuan Li <116717757+MuyuanMS@users.noreply.github.com> Co-authored-by: Muyuan Li (from Dev Box) <muyuanli@microsoft.com>
5.2 KiB
Shortcut Guide
Public overview - Microsoft Learn
Quick Links
Overview
Shortcut Guide is a PowerToy that displays an overlay of available keyboard shortcuts when a user-set keyboard shortcut is pressed. It helps users discover and remember keyboard shortcuts for Windows and apps.
Note
The spec for the manifest files is in development and will be linked here once available.
Usage
- Press the user-defined hotkey to display the overlay
- Press the hotkey again or press ESC to dismiss the overlay
Build and Debug Instructions
Build
- Open PowerToys.slnx in Visual Studio
- Select Release or Debug in the Solutions Configuration drop-down menu
- From the Build menu, choose Build Solution
- The executable is named PowerToys.ShortcutGuide.exe
Debug
- Right-click the ShortcutGuide.Ui project and select 'Set as Startup Project'
- Right-click the project again and select 'Debug'
Note
When run in debug mode, the window behaves differently than in release mode. It will not automatically close when loosing focus, it will be displayed on top of all other windows, and it is not hidden from the taskbar.
Project Structure
The Shortcut Guide module consists of the following 4 projects:
[ShortcutGuide.Ui](/src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuide.Ui.csproj
This is the main UI project for the Shortcut Guide module. Upon startup it does the following tasks:
- Copies the built-in manifest files to the users manifest directory (overwriting existing files).
- Generate the
index.ymlmanifest file. - Populate the PowerToys shortcut manifest with the user-defined shortcuts.
- Starts the UI.
Related files in PowerToys.Interop
excluded_app.cpp
This file contains one function with the following signature:
__declspec(dllexport) bool IsCurrentWindowExcludedFromShortcutGuide()
This function checks if the current window is excluded from the Shortcut Guide overlay. It returns true if the current window is excluded otherwise it returns false.
tasklist_positions.cpp
This file contains helper functions to retrieve the positions of the taskbar buttons. It exports the following function:
__declspec(dllexport) TasklistButton* get_buttons(HMONITOR monitor, int* size)
This function retrieves the positions of the taskbar buttons for a given monitor. It returns an array of TasklistButton structures (max 10), which contain the position and size of each button.
monitor must be the monitor handle of the monitor containing the taskbar instance of which the buttons should be retrieved.
size will contain the resulting array size.
It determines the positions through Windows FindWindowEx function.
For the primary taskbar it searches for:
- A window called "Shell_TrayWnd"
- that contains a window called "ReBarWindow32"
- that contains a window called "MSTaskSwWClass"
- that contains a window called "MSTaskListWClass"
For any secondary taskbar it searches for:
- A window called "Shell_SecondaryTrayWnd"
- that contains a window called "WorkerW"
- that contains a window called "MSTaskListWClass"
It then enumerates all the button elements inside "MSTaskListWClass" while skipping such with a same name (which implies the user does not use combining taskbar buttons)
If this method fails, which it will for newer versions of Windows, it falls back to searching for:
- A window called "Shell_TrayWnd" or "Shell_SecondaryTrayWnd"
- that contains a window called "Windows.UI.Composition.DesktopWindowContentBridge"
- that contains a window called "Windows.UI.Input.InputSite.WindowClass"
- the first child element
It then enumerates all the button elements inside the selected while skipping such with a same name (which implies the user does not use combining taskbar buttons) and such that do not start with "Appid:" (which are not actual taskbar buttons related to apps, but others like the widgets or the search button).
ShortcutGuide.IndexYmlGenerator
This application generates the index.yml manifest file.
It is a separate project so that its code can be easier ported to WinGet in the future.
ShortcutGuideModuleInterface
The module interface that handles opening and closing the user interface.
Features and Limitations
- Currently the displayed shortcuts (Except the ones from PowerToys) are not localized.
- It's currently rated as a P3 (lower priority) module
Future Development
- Implementing with WinGet to get new shortcut manifest files
- Adding localization support for the built-in manifest files