Skip to content

[Shortcut Guide] Add Windows key hold activation options - #49637

Closed
Niels Laute (niels9001) wants to merge 2 commits into
microsoft:mainfrom
niels9001:screen-ruler-guides
Closed

[Shortcut Guide] Add Windows key hold activation options#49637
Niels Laute (niels9001) wants to merge 2 commits into
microsoft:mainfrom
niels9001:screen-ruler-guides

Conversation

@niels9001

@niels9001 Niels Laute (niels9001) commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary of the Pull Request

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

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

image

PR Checklist

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

Detailed Description of the Pull Request / Additional comments

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

Validation Steps Performed

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

Add independent Windows-key hold modes, configurable timing, and close-on-release behavior while preserving the regular activation shortcut.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b8ffa76b-3cf0-4a67-9adb-a13c5dd9f125
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Thank you for contributing to PowerToys. We've detected that this PR might include a new or modified telemetry event. Please ensure the following before merging:

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds configurable “hold Windows key” activation behaviors for Shortcut Guide (Off / taskbar indicators / open full guide), keeping the regular activation hotkey independent, and wires the new behavior end-to-end across Settings UI, Runner hook plumbing, module interface, and the Shortcut Guide UI.

Changes:

  • Introduces new settings fields (Windows-key action, hold duration, close-on-release) with UI + localization + view model logic and unit tests.
  • Updates Runner keyboard-hook pressed-key action handling (per-module clearing) and adds a dedicated Windows-key trigger event routed through the module interface to the UI process.
  • Extends Shortcut Guide UI to listen for the new Windows-key trigger event and handle left/right Windows keys, plus telemetry and docs updates.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/settings-ui/Settings.UI/ViewModels/ShortcutGuideViewModel.cs Adds new Settings-backed properties for Windows-key action, press time clamping, and close-on-release.
src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Adds localized strings for new Shortcut Guide Windows-key settings.
src/settings-ui/Settings.UI/SettingsXAML/Views/ShortcutGuidePage.xaml Adds Settings UI controls (ComboBox + NumberBox + CheckBox) for Windows-key hold behavior.
src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ShortcutGuide.cs Updates back-compat test expectations and adds tests for defaults, normalization, clamping, and persistence.
src/settings-ui/Settings.UI.Library/ShortcutGuideWindowsKeyAction.cs Introduces an enum for Windows-key activation actions.
src/settings-ui/Settings.UI.Library/ShortcutGuideProperties.cs Adds new persisted properties and shared press-time constants (min/max/default).
src/runner/powertoy_module.cpp Clears pressed-key actions on hotkey refresh and routes Win-key long press through a dedicated module callback.
src/runner/centralized_kb_hook.h Adds API to clear pressed-key actions per module.
src/runner/centralized_kb_hook.cpp Implements per-module pressed-key action clearing and ensures timers are killed when clearing.
src/modules/ShortcutGuide/ShortcutGuideModuleInterface/dllmain.cpp Adds Windows-key trigger event + settings parsing for new fields; triggers UI via dedicated event.
src/modules/ShortcutGuide/ShortcutGuide.Ui/Telemetry/ShortcutGuideSettingsEvent.cs Extends telemetry payload with Windows-key action/press-time/close-on-release fields.
src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs Listens to both trigger events and implements Windows-key-triggered overlay behavior (LWIN/RWIN + close-on-release).
src/modules/ShortcutGuide/ShortcutGuide.Ui/Program.cs Passes/consumes Windows-key trigger event name argument; extends telemetry logging parameters.
src/modules/interface/powertoy_module_interface.h Adds on_win_key_long_press() hook to decouple Win-key long-press from normal activation.
src/common/interop/shared_constants.h Adds a new named event constant for Windows-key trigger.
doc/dsc/modules/ShortcutGuide.md Documents new DSC-configurable properties and updated behavior/ranges/examples.
doc/devdocs/modules/shortcut_guide.md Updates developer docs for new activation modes and fixes a broken markdown link.

Comment thread src/modules/ShortcutGuide/ShortcutGuideModuleInterface/dllmain.cpp Outdated
Comment thread src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs Outdated
@niels9001 Niels Laute (niels9001) added 0.102 Product-Shortcut Guide Refers to the Shortcut Guide PowerToy labels Aug 3, 2026
Guard malformed settings properties and avoid arming Windows-key release handling when the overlay is already visible.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b8ffa76b-3cf0-4a67-9adb-a13c5dd9f125
@noraa-junker

Copy link
Copy Markdown
Collaborator

Fixed it in #49661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.102 Product-Shortcut Guide Refers to the Shortcut Guide PowerToy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants