[Shortcut Guide] Add Windows key hold activation options (#49661)

## 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.

<img width="1099" height="611" alt="image"
src="https://github.com/user-attachments/assets/e0fe4c0f-3bef-43f8-a526-d22caf9e484e"
/>


## PR Checklist

- [ ] Closes: N/A
- [x] **Communication:** The UX and behavior were discussed before
implementation
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end-user-facing strings can be localized
- [x] **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.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Muyuan Li (from Dev Box) <muyuanli@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2b3acca3-e49b-4936-8fb9-6f669bd449db
This commit is contained in:
Noraa Junker
2026-08-13 22:27:39 +02:00
committed by GitHub
parent b7891108fa
commit 6c9fb8ce52
10 changed files with 400 additions and 26 deletions

View File

@@ -15,8 +15,17 @@ Shortcut Guide is a PowerToy that displays an overlay of available keyboard shor
> 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
- Press the user-defined hotkey to display the full overlay.
- Optionally, hold either Windows key to show taskbar indicators or the full overlay after a configurable delay.
- Press the hotkey again or press ESC to dismiss the overlay. A full overlay opened by holding the Windows key can either close on key release or remain open, depending on the setting.
The **Hold Windows key** setting is independent of the activation shortcut:
- **Off** leaves the Windows key behavior unchanged.
- **Show taskbar indicators** is the default and always hides the indicators when the Windows key is released.
- **Open Shortcut Guide** can close on Windows-key release or remain open.
The hold duration accepts values from 100 through 5,000 milliseconds and defaults to 900 milliseconds.
## Build and Debug Instructions
@@ -37,7 +46,7 @@ Shortcut Guide is a PowerToy that displays an overlay of available keyboard shor
The Shortcut Guide module consists of the following 4 projects:
### [`ShortcutGuide.Ui`](/src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuide.Ui.csproj
### [`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:

View File

@@ -14,8 +14,8 @@ Manages configuration for the Shortcut Guide utility, which displays available k
## Description
The `ShortcutGuide` module configures PowerToys Shortcut Guide, a utility that
displays an overlay showing available Windows keyboard shortcuts when you hold
the Windows key. It helps users discover and learn keyboard shortcuts.
displays an overlay showing available Windows and application keyboard shortcuts.
It can be opened with a configurable shortcut or by holding either Windows key.
## Properties
@@ -35,7 +35,15 @@ Sets the keyboard shortcut or method to open the shortcut guide.
- `code` (integer) - Virtual key code
- `key` (string) - Key name
**Default:** Hold Windows key for 900ms
**Default:** `Win+Shift+/`
### WindowsKeyAction
Sets the action performed after holding either Windows key.
**Type:** integer
**Allowed values:** `0` (Off), `1` (Show taskbar indicators), `2` (Open Shortcut Guide)
**Default:** `1`
### OverlayOpacity
@@ -58,9 +66,18 @@ Sets the theme for the shortcut guide.
Sets how long the Windows key must be held before showing the guide (in milliseconds).
**Type:** integer
**Range:** `100` to `10000`
**Range:** `100` to `5000`
**Default:** `900`
### CloseOnWindowsKeyRelease
Controls whether the full Shortcut Guide closes when the Windows key is released.
This setting applies when `WindowsKeyAction` is `2`; taskbar indicators always
close on release.
**Type:** boolean
**Default:** `true`
### ExcludedApps
List of applications where Shortcut Guide is disabled.
@@ -71,13 +88,15 @@ List of applications where Shortcut Guide is disabled.
### Example 1 - Configure activation time with direct execution
This example sets a faster activation time for the shortcut guide.
This example opens the full Shortcut Guide after holding a Windows key for 600 milliseconds.
```powershell
$config = @{
settings = @{
properties = @{
WindowsKeyAction = 2
PressTime = 600
CloseOnWindowsKeyRelease = $true
}
name = "ShortcutGuide"
version = "1.0"
@@ -146,7 +165,7 @@ resources:
### Example 4 - Quick activation
This example configures for quick activation with a short press time.
This example configures taskbar indicators with a short hold duration.
```bash
dsc config set --file shortcutguide-quick.dsc.yaml
@@ -161,6 +180,7 @@ resources:
properties:
settings:
properties:
WindowsKeyAction: 1
PressTime: 400
name: ShortcutGuide
version: 1.0