<!-- 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 introduces the new KeystrokeOverlay module to PowerToys, including its documentation, build configuration, installer setup, and spell-check dictionary updates. KeystrokeOverlay can be used to show keys pressed on the screen like Visual Studio Code's Screencast Mode. It provides customization options for text size and background, offers four types of display modes, and three shortcuts for toggling on/off the display, cycling through monitors, and through different display modes (see below for more details). <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] Closes: #981 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [x] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [x] **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 **KeystrokeOverlay Module Integration:** * Added KeystrokeOverlay as a new module in the solution, with corresponding projects for the keyboard service, UI, and module interface (`PowerToys.slnx`). * Added documentation for the Keystroke Overlay module, including architecture, usage, and debugging instructions (`doc/devdocs/modules/keystrokeoverlay.md`). * Updated installer configuration to include Keystroke Overlay, adding new WiX include and setup files (`installer/PowerToysSetup/Common.wxi`, `installer/PowerToysSetup/KeystrokeOverlay.wxs`). [[1]](diffhunk://#diff-ecd2ee19d18433ed47b8f13b44cfff7b00c8009c17bc71139cec0d8571f8f607R1-R59) [[2]](diffhunk://#diff-af48b984b168acbe5aeb021e97a9e826ab9b52c20c08b36f40dd3e5ad00342b1R1-R9) * Registered Keystroke Overlay in the settings documentation and issue templates (`doc/dsc/Settings.md`, `.github/ISSUE_TEMPLATE/bug_report.yml`, `.github/ISSUE_TEMPLATE/translation_issue.yml`). [[1]](diffhunk://#diff-bde46f469b76ba994ea938853f169553846221b329a21e9b59d37c5a0b7d63aeR35) [[2]](diffhunk://#diff-637f7b97bba458badb691a1557c3d4648686292e948dbe3e8360564378b653efR85) [[3]](diffhunk://#diff-135b470e9875068a1085599402d6f89bea163068568c426b22f493f35fbfbea6R58) * Added KeystrokeOverlay binaries to the signing pipeline (`.pipelines/ESRPSigning_core.json`). **Customization options** | Category | Setting | Description | Default / Example | | :--- | :--- | :--- | :--- | | **General** | **Enable Keystroke Overlay** | Master toggle to turn the module on or off. | `On` | | **Shortcuts** | **Activation Shortcut** | Hotkey to toggle the overlay visibility. | `Win` + `Shift` + `K` | | | **Switch Monitor Shortcut** | Hotkey to move the overlay to another display. | `Win` + `Shift` + `/` | | | **Switch Display Mode** | Hotkey to cycle through different visualization modes. | `Win` + `Shift` + `D` | | **Behavior** | **Draggable Overlay** | Allows you to manually move the overlay position with your mouse. | `On` | | | **Display Mode** | Controls what history of keys is shown (e.g., history vs. single). | `Last Five Keystrokes` | | | **Overlay Timeout** | How long (in ms) the keys stay visible before fading. | `2000` ms | | **Appearance** | **Text Size** | Adjusts the font size of the keys inside the overlay. | `37` | | | **Text Color** | Sets the font color and transparency level. | `White` (Example) | | | **Background Color** | Sets the background box color and transparency level. | `Purple` (Example) | <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed The new module was tested on multiple different Windows Devices and all configurations work as expected. --------- Signed-off-by: Shawn Yuan (from Dev Box) <shuaiyuan@microsoft.com> Co-authored-by: Sátvik Karanam <89281036+skara9@users.noreply.github.com> Co-authored-by: Jiří Polášek <me@jiripolasek.com> Co-authored-by: Software2 <software-2@users.noreply.github.com> Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Mike Griese <migrie@microsoft.com> Co-authored-by: Jaylyn Barbee <51131738+Jaylyn-Barbee@users.noreply.github.com> Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com> Co-authored-by: Kai Tao <69313318+vanzue@users.noreply.github.com> Co-authored-by: Mark Russinovich <markruss@microsoft.com> Co-authored-by: Mark Russinovich <markruss@ntdev.microsoft.com> Co-authored-by: Clint Rutkas <clint@rutkas.com> Co-authored-by: Alex Mihaiuc <69110671+foxmsft@users.noreply.github.com> Co-authored-by: Michael Jolley <mike@baldbeardedbuilder.com> Co-authored-by: Gordon Lam <73506701+yeelam-gordon@users.noreply.github.com> Co-authored-by: leileizhang <leilzh@microsoft.com> Co-authored-by: Dave Rayment <dave.rayment@gmail.com> Co-authored-by: Shawn Yuan <128874481+shuaiyuanxx@users.noreply.github.com> Co-authored-by: Kai Tao <kaitao@microsoft.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: jiripolasek <4773077+jiripolasek@users.noreply.github.com> Co-authored-by: Dustin L. Howett <duhowett@microsoft.com> Co-authored-by: Sam Rueby <samrueby@gmail.com> Co-authored-by: Lee Won Jun <dldnjs1013@nate.com> Co-authored-by: Mason Bergstrom <13530957+MasonBergstrom@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Mike Hall <mikehall@microsoft.com> Co-authored-by: moooyo <42196638+moooyo@users.noreply.github.com> Co-authored-by: Yu Leng <yuleng@microsoft.com> Co-authored-by: dsm20 <74568547+dsm20@users.noreply.github.com> Co-authored-by: zackpaton <91792781+zackpaton@users.noreply.github.com> Co-authored-by: Gleb Khmyznikov <gleb.khmyznikov@gmail.com> Co-authored-by: Guilherme <57814418+DevLGuilherme@users.noreply.github.com>
4.9 KiB
Keystroke Overlay - Will live in doc/devdocs/modules
Public overview - Microsoft Learn
Quick Links
Overview
Keystroke Overlay is a PowerToys module that displays keyboard input live. There are three different display modes. Single-key display shows the last key pressed, e.g. "o." Last five keys display shows the last five keys pressed, e.g. "h e l l o." Shortcut display supports shortcuts, e.g. "ctrl + v." This module is meant to be used as a helpful tool for educators, presenters, and/or visually impaired users.
Architecture
The Keystroke Overlay module consists of three main components:
keystrokeoverlay/
├── KeystrokeOverlayKeyboardService/ # Keyboard Hook
├── KeystrokeOverlayXAML/ # The overlaying display UI
└── KeystrokeOverlayModuleInterface/ # DLL Interface
Keyboard Service (KeystrokeOverlayKeyboardService)
The Keyboard Service component is responsible for:
- Compiles KeystrokeEvent.h, EventQueue.h, Batcher.cpp, and KeyboardListener.cpp into PowerToys.KeystrokeOverlayKeystrokeServer.exe
- Implements keyboard hooks to detect key presses
- Manages the trigger mechanism for displaying the keystroke overlay
- Handles keyboard input processing
UI Layer (KeystrokeOverlayXAML)
The UI component is responsible for:
- Displaying the overlay of pressed keys
- Managing the visual positioning of the overlay
Module Interface (KeystrokeOverlayModuleInterface)
The Module Interface, implemented in KeystrokeOverlayModuleInterface/dllmain.cpp, is responsible for:
- Handling communication between PowerToys Runner and the KeystrokeOverlay process
- Managing module lifecycle (enable/disable/settings)
- Launching and terminating the PowerToys.KeystrokeOverlay.exe process (as well as PowerToys.KeystrokeOverlayKeystrokeServer.exe as a child process)
Implementation Details
Activation Mechanism
The Keystroke Overlay is activated when:
- A user presses or holds any key
- After a brief delay (around 300ms per setting), the overlay appears
- Upon releasing the key(s), the overlay hovers for around 300ms or a value specified in settings, then disappears
Character Sets
The module supports multiple language-specific characters. Since the module uses keyboard codes to detect key presses and trigger the display, various keyboards and languages are supported by Keystroke Overlay, as long as they are supported by Windows.
Known Behaviors
- If a key is pressed and held, this is processed as several presses of the same key in rapid succession
- Stream mode detects capital letters as shortcuts because the shift key is pressed and separates them from words; e.g. “Hello” in stream mode appears as “H ello”
Future Considerations
- Add support for different appearances, other than left-to-right. Right-to-left or center-outwards would be beneficial, especially for users who communicate in languages that read right-to-left
- Add support for default positioning, e.g. top-left, bottom-center, middle-right, …
Debugging
To debug the Keystroke Overlay module via runner approach, follow these steps:
- Get familiar with the overall Debugging Process for PowerToys.
- Build the entire PowerToys solution in Visual Studio
- Navigate to the KeystrokeOverlay folder in Solution Explorer
- Open the file you want to debug and set breakpoints at the relevant locations
- Find the runner project in the root of the solution
- Right-click on the runner project and select "Set as Startup Project"
- Start debugging by pressing
F5or clicking the "Start" button - When the PowerToys Runner launches, enable the Keystroke Overlay module in the UI
- Use the Visual Studio Debug menu or press
Ctrl+Alt+Pto open "Reattach to Process" - Find and select "PowerToys.KeystrokeOverlay.exe" in the process list
- Trigger the action in Keystroke Overlay that should hit your breakpoint
- Verify that the debugger breaks at your breakpoint and you can inspect variables and step through code
This process allows you to debug the Keystroke Overlay module while it's running as part of the full PowerToys application.
Alternative Debugging Approach
To directly debug the Keystroke Overlay UI component:
- Get familiar with the overall Debugging Process for PowerToys.
- Build the entire PowerToys solution in Visual Studio
- Navigate to the KeystrokeOverlay folder in Solution Explorer
- Open the file you want to debug and set breakpoints at the relevant locations
- Right-click on the KeystrokeOverlayUI project and select "Set as Startup Project"
- Start debugging by pressing
F5or clicking the "Start" button - Verify that the debugger breaks at your breakpoint and you can inspect variables and step through code