[Shortcut Guide] Add Windows key hold activation options - #49661
[Shortcut Guide] Add Windows key hold activation options #49661noraa-junker wants to merge 7 commits into
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. |
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.