Repository navigation
[Shortcut Guide] Add Windows key hold activation options - #49661
Conversation
There was a problem hiding this comment.
🟡 Not ready to approve
There are confirmed behavior gaps/bugs in the Shortcut Guide UI/module interface around Windows-key handling and settings enforcement (notably RWIN detection and Runner-level disablement).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Adds configurable “hold Windows key” activation behaviors to Shortcut Guide, wiring new settings through the Settings UI, settings model, module interface, UI runtime behavior, tests, and documentation.
Changes:
- Introduces a new Windows-key hold action setting (Off / taskbar indicators / full guide), plus hold-duration and close-on-release options.
- Plumbs the new settings through the Settings UI (ViewModel + XAML + localized strings) and updates module/UI logic to honor them.
- Updates unit tests and developer/DSC documentation to cover the new settings and defaults.
File summaries
| File | Description |
|---|---|
| src/settings-ui/Settings.UI/ViewModels/ShortcutGuideViewModel.cs | Adds ViewModel properties for Windows-key action, hold duration, and close-on-release with normalization/clamping. |
| src/settings-ui/Settings.UI/Strings/en-us/Resources.resw | Adds localized strings for the new settings UI. |
| src/settings-ui/Settings.UI/SettingsXAML/Views/ShortcutGuidePage.xaml | Adds new settings expander UI (ComboBox + NumberBox + CheckBox) for Windows-key hold behavior. |
| src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ShortcutGuide.cs | Extends tests for defaults, normalization, persistence, and back-compat expectations. |
| src/settings-ui/Settings.UI.Library/ShortcutGuideWindowsKeyAction.cs | Adds enum representing Windows-key hold action. |
| src/settings-ui/Settings.UI.Library/ShortcutGuideProperties.cs | Adds persisted properties + constants for defaults and press-time bounds. |
| src/modules/ShortcutGuide/ShortcutGuideModuleInterface/dllmain.cpp | Uses configured press_time for Runner’s long-press threshold instead of a constant. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs | Updates runtime behavior to support Off / taskbar indicators / full guide + close-on-release. |
| doc/dsc/modules/ShortcutGuide.md | Documents new DSC properties and updated defaults/ranges. |
| doc/devdocs/modules/shortcut_guide.md | Updates end-user/developer documentation for the new activation behaviors. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 4
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Not ready to approve
The “Off” Windows-key action is not fully enforced at the Runner/module-interface registration level, so Win-key long-press callbacks can still fire and launch/signaled behavior can still occur.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Suppressed comments (3)
src/modules/ShortcutGuide/ShortcutGuideModuleInterface/dllmain.cpp:170
- The new “WindowsKeyAction = Off” setting doesn’t actually disable Windows-key long-press activation at the Runner/hook level: this module still returns true from keep_track_of_pressed_win_key(), so Runner will continue registering VK_LWIN/VK_RWIN pressed-key timers that invoke OnHotkeyEx(), which can still start the ShortcutGuide process and signal the trigger event. This contradicts the PR’s stated ability to disable Windows-key activation and also adds avoidable background work when users choose Off.
Consider parsing win_key_action here and returning false from keep_track_of_pressed_win_key() when it is Off (and/or early-returning in OnHotkeyEx() for win-key-triggered launches) so Runner doesn’t register or fire long-press callbacks when disabled.
virtual bool keep_track_of_pressed_win_key() override { return true; }
virtual UINT milliseconds_win_key_must_be_pressed() override { return m_millisecondsWinKeyPressTimeForGlobalWindowsShortcuts; }
src/modules/ShortcutGuide/ShortcutGuideModuleInterface/dllmain.cpp:306
- The
trystatement is mis-indented compared to the surrounding block, which makes this section harder to read and looks like an accidental formatting regression (likely should be clang-formatted).
try
{
src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs:207
- These declarations lost their indentation inside the dispatched lambda, which hurts readability and is inconsistent with the surrounding code formatting.
const int VK_LWIN = 0x5B;
const int VK_RWIN = 0x5C;
bool winKeyDown = ((NativeMethods.GetAsyncKeyState(VK_LWIN) & 0x8000) != 0) ||
((NativeMethods.GetAsyncKeyState(VK_RWIN) & 0x8000) != 0);
- Files reviewed: 10/10 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
No this hasn't happened once while testing and neither has this happened once with the old Shortcut Guide which used the same system. |
|
Copilot |
Co-authored-by: noraa-junker <58633848+noraa-junker@users.noreply.github.com>
Co-authored-by: noraa-junker <58633848+noraa-junker@users.noreply.github.com>
... Fixed in 2334fbd. |
Update the PR to current main without rewriting author history. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2b3acca3-e49b-4936-8fb9-6f669bd449db
Apply the outstanding review fix on behalf of the author so the feature can be considered for the upcoming release. The author has not responded since the latest review comments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2b3acca3-e49b-4936-8fb9-6f669bd449db
## 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 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7b3fb20d-6e9d-4fef-a5cd-f8921d28c220
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.
PR Checklist
Detailed Description of the Pull Request / Additional comments
press_timesetting and documents the new options.Validation Steps Performed
ShortcutGuide.UnitTests: 7/7 passed.