Repository navigation
Shortcut Guide: Replace dual windows with single transparent overlay and add holding windows button - #48683
Merged
Niels Laute (niels9001) merged 19 commits intoJul 27, 2026
Conversation
Niels Laute (niels9001)
requested review from
Copilot and
Noraa Junker (noraa-junker)
and removed request for
Noraa Junker (noraa-junker)
June 16, 2026 17:39
Refactor Shortcut Guide UI from two separate WindowEx instances (MainWindow + TaskbarWindow) to a single full-monitor transparent OverlayWindow that hosts both surfaces as XAML UserControls (pseudo-windows). Key changes: - New OverlayWindow with TransparentTintBackdrop as the host - MainPaneControl: main shortcut list with per-card acrylic backdrop - TaskbarPaneControl + TaskbarIndicator: tooltip-style indicators with triangle tails, positioned above taskbar buttons - Robust multi-monitor DPI handling (WM_DPICHANGED suppression pattern) - Win11 phantom border elimination (7-layer DWM/style stripping) - Windows 11 system flyout animations (slide + fade, direction-aware based on left/right position setting, ~367ms entrance, ~200ms exit) - Close button on main flyout title bar - Click-outside-to-close with animated exit transition Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Niels Laute (niels9001)
force-pushed
the
niels9001/shortcutguide-transparent-overlay
branch
from
June 16, 2026 17:42
595ac09 to
b2f5d1d
Compare
Contributor
There was a problem hiding this comment.
⚠️ Not ready to approve
There are critical lifetime/shutdown issues (GC-sensitive WindowMessageMonitor and unsafe Task.Dispose() on unload) that can break DPI suppression or crash during close.
Pull request overview
This PR refactors Shortcut Guide’s WinUI surface from two separate WindowEx instances (MainWindow + TaskbarWindow) into a single full-monitor transparent OverlayWindow hosting two XAML UserControl “pseudo-windows” (main pane + taskbar indicators), enabling coordinated animations and improved visual polish while simplifying window management.
Changes:
- Replace
MainWindow/TaskbarWindowwith a singleOverlayWindowhostingMainPaneControlandTaskbarPaneControl. - Add Win11-style implicit animations and new taskbar indicator visuals (tooltip body + triangle tail).
- Add robustness improvements: WM_DPICHANGED suppression during cross-monitor moves, stripped native chrome, and explicit
Application.Current.Exit()on window close to fix lingering process lifetime.
File summaries
| File | Description |
|---|---|
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/TaskbarWindow.xaml.cs | Removes the standalone taskbar indicator window implementation. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/TaskbarWindow.xaml | Removes the taskbar indicator window XAML. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/OverlayWindow.xaml.cs | Adds the new single transparent overlay window host, message hooks, DPI handling, and close behavior. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/OverlayWindow.xaml | Adds the overlay window XAML layout hosting the main pane and taskbar layer. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/MainWindow.xaml.cs | Removes the old primary WindowEx implementation now replaced by MainPaneControl. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/MainWindow.xaml | Removes the old main window XAML now replaced by MainPaneControl. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/Controls/TaskbarPaneControl.xaml.cs | Adds the taskbar indicators “pseudo-window” logic as a UserControl with computed layout. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/Controls/TaskbarPaneControl.xaml | Adds the taskbar pane XAML container. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/Controls/TaskbarIndicator.xaml | Updates indicator visuals and adds implicit animations + triangle tail styling. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/Controls/MainPaneControl.xaml.cs | Moves former main-window behaviors (nav initialization, selection handling) into a UserControl. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/Controls/MainPaneControl.xaml | Adds the main pane “pseudo-window” chrome (acrylic, shadow) and title bar UI (incl. close button). |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/Backdrops/AlwaysActiveDesktopAcrylicBackdrop.cs | Adds a custom backdrop to keep acrylic “active” even when window focus changes. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs | Switches app startup to create/activate OverlayWindow and explicitly exits on close. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuide.Ui.csproj | Updates XAML Page items to compile the new overlay and controls; removes old window page. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/Program.cs | Adds startup logging for captured foreground window (for nav ordering diagnostics). |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/NativeMethods.cs | Adds extra Win32 interop needed for monitor-from-cursor work-area sizing and chrome stripping. |
| src/modules/ShortcutGuide/ShortcutGuide.Ui/Helpers/TasklistPositions.cs | Updates taskbar button enumeration to use the new App.OverlayWindow handle. |
Copilot's findings
- Files reviewed: 18/18 changed files
- Comments generated: 3
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
Comment on lines
+66
to
+90
| internal TaskbarPaneControl TaskbarPaneControl => this.TaskbarPane; | ||
|
|
||
| public OverlayWindow() | ||
| { | ||
| this.InitializeComponent(); | ||
|
|
||
| // TransparentTintBackdrop cannot be referenced from XAML in the | ||
| // current Windows App SDK schema; set it here instead. | ||
| this.SystemBackdrop = new TransparentTintBackdrop(); | ||
|
|
||
| this.Title = ResourceLoaderInstance.ResourceLoader.GetString("Title"); | ||
| this.ExtendsContentIntoTitleBar = true; | ||
| this.AppWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Collapsed; | ||
|
|
||
| // Install the message hook BEFORE the first MoveAndResize so the | ||
| // WM_DPICHANGED suppression is in place from the very first | ||
| // cross-monitor move. Otherwise the constructor's initial | ||
| // RepositionToCursorMonitor() lets the default WndProc auto- | ||
| // resize the window by (newDpi/oldDpi) and we get a 1.5× | ||
| // overlay on the laptop screen. Also disable | ||
| // WM_NCLBUTTONDBLCLK so the OS doesn't try to maximize when | ||
| // the user double-clicks anywhere in the (collapsed) caption | ||
| // area. Matches the original MainWindow behavior. | ||
| WindowMessageMonitor msgMonitor = new(this); | ||
| msgMonitor.WindowMessageReceived += (_, e) => |
Comment on lines
+79
to
+82
| private void OnUnloaded(object sender, RoutedEventArgs e) | ||
| { | ||
| _getAppIdsTask.Dispose(); | ||
| } |
This was referenced Jun 24, 2026
Shortcut Guide now stays alive in the background, but each invocation navigated ContentFrame to a brand-new ShortcutsPage (an ItemsRepeater of ~one screenful of ShortcutItemView rows). WinUI never released the prior page: the managed wrappers had zero GC roots yet survived a blocking GC.Collect because live CsWinRT ComWrappers CCWs pinned the native XAML tree, so ~1 ShortcutsPage (and its rows) leaked per open. Fix: reuse one ShortcutsPage and just refresh its Rows collection. - MainPaneControl.Hide() keeps the page as ContentFrame.Content and calls ClearData() instead of navigating to a blank page, nulling Content, and running a GC.Collect hack. - WindowSelector_SelectionChanged reuses the existing page via the new ShortcutsPage.SetShortcuts(file, appName); the frame navigates only once. - Remove the dead workaround scaffolding (BlankPage, ShortcutPageNavParam, ForceItemsRepeaterCleanup) that could not help against native CCW pinning. Also fix pre-existing build-breaking typos on this branch so the module compiles (stray spaces jammed into identifiers / trailing whitespace): MainPaneControl.xaml 'encod ing', OverlayWindow.xaml 'Horizo ntalAlignment', App.xaml.cs 'this. LoadData()', ShortcutDescriptionToKeysConverter.cs. Verified with a headless open/close harness: after 6 cycles live ShortcutsPage stays at 1 (was 1-per-open) and ShortcutItemView stays bounded to a single page. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CloseAnimated() created a new DispatcherQueueTimer and a fresh Tick closure on every close. Heap dumps showed one such closure (OverlayWindow+<>c__DisplayClass) accumulating ~1 per open as short-lived garbage. Create the one-shot timer once and bind it to a named OnCloseTimerTick method, then just restart it per close so no timer or closure is allocated after the first close. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add two opt-in properties to the shared TransparentWindow (both default false, no-ops unless the consumer activates the window): - DismissOnEscape: Esc on focused content calls Hide(). Input is hooked lazily at show time since Content is set by the consumer after the ctor. - DismissOnFocusLost: light dismiss on deactivation, guarded by a seen-activated flag (reset each Show) so the transient deactivation during the show sequence does not dismiss prematurely. Mirrors the hand-rolled guards in PowerDisplay (_isShowingWindow) and Quick Access (_hasSeenInteractiveActivation), which can adopt this once they derive from TransparentWindow. Also document multi-surface hosting in the class remarks: multiple TransientSurfaces can SubscribeTo one window; HidingEventArgs aggregates deferrals so the window hides only after all surfaces animate out, and plain Show() lets each surface play its own configured transition. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…de-transparent-overlay # Conflicts: # src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs # src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/MainWindow.xaml.cs # src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/TaskbarWindow.xaml.cs
Reuse the shared transparent-overlay infrastructure now in Common.UI.Controls instead of Shortcut Guide's hand-rolled copies: - OverlayWindow now derives from the shared TransparentWindow, dropping the duplicated chrome boilerplate (TransparentTintBackdrop, title-bar extension/collapse, native-frame stripping, DWM border/corner attributes and their P/Invokes). The edge-to-edge phantom-border elimination is expressed as an opt-in TransparentWindow.ApplyFullBleed Hardening() that this monitor-sized overlay calls (and re-applies after cross-monitor DPI changes alongside ApplyTransparentChrome()). - TransparentWindow gains a re-appliable protected ApplyTransparentChrome() and the opt-in ApplyFullBleedHardening() (the full-bleed DWM hardening deferred from the dismiss PR). Both are no-ops for existing content-sized consumers, which never call the full-bleed path. - Delete Shortcut Guide's duplicate AlwaysActiveDesktopAcrylicBackdrop and point MainPaneControl at the shared Common.UI.Controls backdrop (the local copy's own docs asked for this once the shared type landed); drop the now-unused backdrops namespace from TaskbarIndicator. - Add the Common.UI.Controls project reference to ShortcutGuide.Ui. Also merges origin/main into the branch (resolving App.xaml.cs to keep the single-OverlayWindow launch inside main's defensive try/catch, and keeping the MainWindow/TaskbarWindow deletions). MainPaneControl/TaskbarIndicator -> TransientSurface conversion is left as a follow-up (it reworks the activate-based animation/close model). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace MainPaneControl's hand-rolled pseudo-window chrome (1px border + 8px corner radius + ThemeShadow via Translation Z=24 + SystemBackdropElement with the shared acrylic backdrop) with the shared TransientSurface from Common.UI.Controls, which provides exactly that chrome — including the built-in ThemeShadow — out of the box. The surface's built-in show/hide transitions are left at the default (None): OverlayWindow still drives the pane's slide+fade entrance/exit keyed to the user's left/right alignment, so this is a chrome-only reuse with no change to the tuned animation/close orchestration. AcrylicKind=Default preserves the previous (non-Thin) acrylic look. TaskbarIndicator is intentionally left unconverted: it is a tooltip with a downward triangle tail painted with a solid acrylic fill brush, which the rounded-rect TransientSurface does not model. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ening' into niels9001/shortcutguide-transparent-overlay # Conflicts: # src/common/Common.UI.Controls/Window/TransparentWindow/TransparentWindow.cs
…ght) Detect the taskbar edge via the public SHAppBarMessage/ABM_GETTASKBARPOS API and lay out the Win+1..9 taskbar number indicators along the correct axis with tails pointing toward the taskbar. For left/right taskbars the main pane is inset so the order is taskbar | indicators | pane. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Derive each indicator's body size from the measured UIA taskbar button rect instead of a fixed 40 DIP, so the bubbles shrink when Windows uses small icons or combines buttons (many apps open). Uses the smallest button slot along the taskbar (clamped to 28-40 DIP) so neighbouring bubbles never overlap, and scales the font with it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Keep WindowMessageMonitor alive as a field so a GC can't silently drop the WM_DPICHANGED suppression / WM_NCLBUTTONDBLCLK hook.\n- Stop disposing the background app-id Task on unload (could throw InvalidOperationException if it had not completed); Task disposal is unnecessary here.\n- Run XamlStyler on the changed Shortcut Guide XAML files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ay branch # Conflicts: # src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs # src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/Controls/MainPaneControl.xaml.cs
The kept-alive SG process showed the overlay via a bare AppWindow.Show(), which loses the Windows foreground lock so the transparent full-monitor overlay rendered behind the active window (invisible). Add OverlayWindow.ShowOverlay() that repositions to the cursor monitor and forces foreground via AttachThreadInput + BringWindowToTop + SetForegroundWindow + Activate. Replace WPF Keyboard.IsKeyDown with Win32 GetAsyncKeyState and add listener diagnostics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Indicators were cleared and recreated on every open. Each new instance registered persistent CommunityToolkit Implicit show/hide composition animations on its visual; recreating the elements every open accumulated composition resources the managed GC never reclaimed, so working set grew on each open/dismiss cycle. ApplySlideAnimations also ran twice per indicator (ctor + CreateIndicator). Pool the TaskbarIndicator instances (reuse across opens, add/trim only the delta, reconfigure in place), rebuild the grid layout only when the tail direction changes, and replace the Implicit animations with a one-shot AnimationBuilder entrance replayed per open (transient batch that frees itself). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…de-fix-conflicts # Conflicts: # src/common/Common.UI.Controls/Window/TransparentWindow/TransparentWindow.cs # src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/MainWindow.xaml.cs
Noraa Junker (noraa-junker)
approved these changes
Jul 25, 2026
Niels Laute (niels9001)
deleted the
niels9001/shortcutguide-transparent-overlay
branch
July 27, 2026 10:21
This was referenced Aug 3, 2026
This was referenced Aug 18, 2026
[Shortcut Guide] Win+Shift+/ activation is disabled or misrouted by Hold Windows key settings
#49990
Closed
Boliang Zhang (LegendaryBlair)
added a commit
that referenced
this pull request
Aug 21, 2026
## Summary of the Pull Request **Regression:** PR #48683 changed Shortcut Guide from a process launched per invocation to a persistent background process. Before that change, every activation started a process and evaluated the current foreground app against the latest excluded-app settings. The excluded-app check remained in `Program.Main`, so after #48683 it ran only when the persistent process started. Excluded apps therefore stopped blocking later regular-hotkey and Windows-key-hold activations, and newly saved exclusions had no effect until the process was recycled. This PR restores the pre-#48683 excluded-app behavior by: - starting the persistent Shortcut Guide listener regardless of the startup foreground app; - evaluating the current foreground app against the latest excluded-app settings before each hidden-overlay activation; - applying the same gate to the regular hotkey and Windows-key-hold paths; and - preserving close and hold-surface promotion behavior when the overlay is already visible. ## PR Checklist - [x] Closes: #50030 - [ ] **Communication:** This regression was diagnosed from the issue and recent Shortcut Guide lifecycle changes; it has not yet been discussed with core contributors - [x] **Tests:** Added/updated and all pass - [x] **Localization:** N/A - no end-user-facing strings were added or changed - [x] **Dev docs:** N/A - no public behavior or developer contract changed - [x] **New binaries:** N/A - no binaries or projects were added - [x] **Documentation updated:** N/A - this is a regression fix restoring existing behavior ## Detailed Description of the Pull Request / Additional comments `src/modules/ShortcutGuide/ShortcutGuide.Ui/Program.cs` no longer exits at process startup when the then-foreground application is excluded. The background listener must remain available for later activations. `src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs` calls the existing native excluded-app helper for each activation while the overlay is hidden. That helper already reloads `settings.json` and rebuilds its excluded-app list on every call, so no watcher or cache is needed. The result is passed into `src/modules/ShortcutGuide/ShortcutGuide.Ui/Helpers/ShortcutGuideActivationPolicy.cs`, keeping the decision shared by both activation sources and directly testable. The check is intentionally skipped while the overlay is visible. This preserves the regular hotkey's ability to close its guide or take ownership of a guide opened by Windows-key hold. Suppression logging is generic and does not include application names, paths, window titles, or settings content. This is a regression fix rather than a new excluded-app feature or settings-schema change. ## Validation Steps Performed - Built `src/modules/ShortcutGuide/ShortcutGuide.UnitTests/ShortcutGuide.UnitTests.csproj` for x64 Release from the final rebased commit. - Ran the Shortcut Guide test executable: **48 passed, 0 failed, 0 skipped**. - Added cases covering: - regular-hotkey suppression over an excluded app; - Windows-key-hold suppression for taskbar indicators and the full guide; - closing a visible regular guide; and - promoting visible hold indicators with the regular hotkey. - Built a complete local x64 Release payload and confirmed its Runner launched the local Shortcut Guide process and handled open/close activation. Copilot-Session: 8271bded-18e8-474e-8e3b-addd71f67f50
Boliang Zhang (LegendaryBlair)
added a commit
that referenced
this pull request
Aug 21, 2026
## Summary of the Pull Request **Regression:** PR #48683 changed Shortcut Guide from a process launched per invocation to a persistent background process. Before that change, every activation started a process and evaluated the current foreground app against the latest excluded-app settings. The excluded-app check remained in `Program.Main`, so after #48683 it ran only when the persistent process started. Excluded apps therefore stopped blocking later regular-hotkey and Windows-key-hold activations, and newly saved exclusions had no effect until the process was recycled. This PR restores the pre-#48683 excluded-app behavior by: - starting the persistent Shortcut Guide listener regardless of the startup foreground app; - evaluating the current foreground app against the latest excluded-app settings before each hidden-overlay activation; - applying the same gate to the regular hotkey and Windows-key-hold paths; and - preserving close and hold-surface promotion behavior when the overlay is already visible. ## PR Checklist - [x] Closes: #50030 - [ ] **Communication:** This regression was diagnosed from the issue and recent Shortcut Guide lifecycle changes; it has not yet been discussed with core contributors - [x] **Tests:** Added/updated and all pass - [x] **Localization:** N/A - no end-user-facing strings were added or changed - [x] **Dev docs:** N/A - no public behavior or developer contract changed - [x] **New binaries:** N/A - no binaries or projects were added - [x] **Documentation updated:** N/A - this is a regression fix restoring existing behavior ## Detailed Description of the Pull Request / Additional comments `src/modules/ShortcutGuide/ShortcutGuide.Ui/Program.cs` no longer exits at process startup when the then-foreground application is excluded. The background listener must remain available for later activations. `src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs` calls the existing native excluded-app helper for each activation while the overlay is hidden. That helper already reloads `settings.json` and rebuilds its excluded-app list on every call, so no watcher or cache is needed. The result is passed into `src/modules/ShortcutGuide/ShortcutGuide.Ui/Helpers/ShortcutGuideActivationPolicy.cs`, keeping the decision shared by both activation sources and directly testable. The check is intentionally skipped while the overlay is visible. This preserves the regular hotkey's ability to close its guide or take ownership of a guide opened by Windows-key hold. Suppression logging is generic and does not include application names, paths, window titles, or settings content. This is a regression fix rather than a new excluded-app feature or settings-schema change. ## Validation Steps Performed - Built `src/modules/ShortcutGuide/ShortcutGuide.UnitTests/ShortcutGuide.UnitTests.csproj` for x64 Release from the final rebased commit. - Ran the Shortcut Guide test executable: **48 passed, 0 failed, 0 skipped**. - Added cases covering: - regular-hotkey suppression over an excluded app; - Windows-key-hold suppression for taskbar indicators and the full guide; - closing a visible regular guide; and - promoting visible hold indicators with the regular hotkey. - Built a complete local x64 Release payload and confirmed its Runner launched the local Shortcut Guide process and handled open/close activation. Copilot-Session: 8271bded-18e8-474e-8e3b-addd71f67f50 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7b3fb20d-6e9d-4fef-a5cd-f8921d28c220
2 tasks done
Boliang Zhang (LegendaryBlair)
added a commit
that referenced
this pull request
Aug 25, 2026
## Summary of the Pull Request Prevents Shortcut Guide processes from surviving Runner shutdown and blocking PowerToys upgrades. - Shuts down WinUI through its dispatcher instead of forcing CLR termination from a worker thread. - Opens and retains the Runner process handle before WinUI initialization so early Runner exits cannot be missed. - Gives the native module deterministic ownership of the Shortcut Guide process handle, with graceful shutdown and a bounded forced-termination fallback. - Keeps telemetry subprocess handles separate from the persistent UI process. - Adds `PowerToys.ShortcutGuide.exe` to the installer termination fallback so affected existing installations can recover during upgrade. ## PR Checklist - [x] **Communication:** Discussed and requested by a core contributor after investigating the release regression. - [x] **Tests:** Existing tests pass; process lifecycle and installer file replacement were also validated. ## Detailed Description of the Pull Request / Additional comments The Shortcut Guide lifecycle introduced by #48683 could call `Environment.Exit` from a Runner-watcher worker thread while WinUI was still tearing down. The native module also overwrote its persistent child-process handle when launching telemetry and did not close completed handles. Repeated Runner lifetimes could therefore leave `PowerToys.ShortcutGuide.exe` processes retaining shared WinUI files. The installer did not recover from that state: Restart Manager is disabled, the bundle and WiX close-application steps target only `PowerToys.exe`, and `TerminateProcessesCA` did not include `PowerToys.ShortcutGuide.exe`. Locked files could consequently remain at the previous version while installation continued, producing a mixed payload. `src/modules/ShortcutGuide/ShortcutGuide.Ui/Program.cs` now synchronously captures the Runner process handle and publishes its exit through a wait handle. `src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs` registers that wait with the UI dispatcher, centralizes idempotent shutdown, and disposes activation listeners and hooks deterministically. `src/modules/ShortcutGuide/ShortcutGuideModuleInterface/dllmain.cpp` now uses RAII for the tracked UI process, avoids replacing it with telemetry handles, signals the existing native exit event, waits for graceful shutdown, and terminates only as a bounded fallback. The event is projected to managed code through `src/common/interop/Constants.idl`. `installer/PowerToysSetupCustomActionsVNext/CustomAction.cpp` now includes `PowerToys.ShortcutGuide.exe` in the MSI process-termination fallback, allowing upgrades from already-affected builds. ## Validation Steps Performed - Built `PowerToys.Interop.vcxproj`, `ShortcutGuideModuleInterface.vcxproj`, `ShortcutGuide.Ui.csproj`, and `PowerToysSetupCustomActionsVNext.vcxproj` for x64 Release. - Built and ran `ShortcutGuide.UnitTests`: 48/48 passed. - Repeated Runner/Shortcut Guide startup and parent-exit teardown 10 times; every child exited with code 0. - Verified the race where the Runner exits before Shortcut Guide initializes. - Verified `PowerToys.ShortcutGuide.exe`, `PowerToys.Interop.dll`, and `Microsoft.UI.Xaml.dll` were immediately replaceable after shutdown. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7f6c4822-53e0-42ae-a51a-a302a7c6d3ab
Boliang Zhang (LegendaryBlair)
added a commit
that referenced
this pull request
Aug 25, 2026
## Summary of the Pull Request Prevents Shortcut Guide processes from surviving Runner shutdown and blocking PowerToys upgrades. - Shuts down WinUI through its dispatcher instead of forcing CLR termination from a worker thread. - Opens and retains the Runner process handle before WinUI initialization so early Runner exits cannot be missed. - Gives the native module deterministic ownership of the Shortcut Guide process handle, with graceful shutdown and a bounded forced-termination fallback. - Keeps telemetry subprocess handles separate from the persistent UI process. - Adds `PowerToys.ShortcutGuide.exe` to the installer termination fallback so affected existing installations can recover during upgrade. ## PR Checklist - [x] **Communication:** Discussed and requested by a core contributor after investigating the release regression. - [x] **Tests:** Existing tests pass; process lifecycle and installer file replacement were also validated. ## Detailed Description of the Pull Request / Additional comments The Shortcut Guide lifecycle introduced by #48683 could call `Environment.Exit` from a Runner-watcher worker thread while WinUI was still tearing down. The native module also overwrote its persistent child-process handle when launching telemetry and did not close completed handles. Repeated Runner lifetimes could therefore leave `PowerToys.ShortcutGuide.exe` processes retaining shared WinUI files. The installer did not recover from that state: Restart Manager is disabled, the bundle and WiX close-application steps target only `PowerToys.exe`, and `TerminateProcessesCA` did not include `PowerToys.ShortcutGuide.exe`. Locked files could consequently remain at the previous version while installation continued, producing a mixed payload. `src/modules/ShortcutGuide/ShortcutGuide.Ui/Program.cs` now synchronously captures the Runner process handle and publishes its exit through a wait handle. `src/modules/ShortcutGuide/ShortcutGuide.Ui/ShortcutGuideXAML/App.xaml.cs` registers that wait with the UI dispatcher, centralizes idempotent shutdown, and disposes activation listeners and hooks deterministically. `src/modules/ShortcutGuide/ShortcutGuideModuleInterface/dllmain.cpp` now uses RAII for the tracked UI process, avoids replacing it with telemetry handles, signals the existing native exit event, waits for graceful shutdown, and terminates only as a bounded fallback. The event is projected to managed code through `src/common/interop/Constants.idl`. `installer/PowerToysSetupCustomActionsVNext/CustomAction.cpp` now includes `PowerToys.ShortcutGuide.exe` in the MSI process-termination fallback, allowing upgrades from already-affected builds. ## Validation Steps Performed - Built `PowerToys.Interop.vcxproj`, `ShortcutGuideModuleInterface.vcxproj`, `ShortcutGuide.Ui.csproj`, and `PowerToysSetupCustomActionsVNext.vcxproj` for x64 Release. - Built and ran `ShortcutGuide.UnitTests`: 48/48 passed. - Repeated Runner/Shortcut Guide startup and parent-exit teardown 10 times; every child exited with code 0. - Verified the race where the Runner exits before Shortcut Guide initializes. - Verified `PowerToys.ShortcutGuide.exe`, `PowerToys.Interop.dll`, and `Microsoft.UI.Xaml.dll` were immediately replaceable after shutdown. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7f6c4822-53e0-42ae-a51a-a302a7c6d3ab Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7b3fb20d-6e9d-4fef-a5cd-f8921d28c220
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors Shortcut Guide from two separate
WindowExinstances (MainWindow+TaskbarWindow) into a single full-monitor transparentOverlayWindowthat hosts both surfaces as XAML UserControls. This enables shared animations and a more polished visual experience, and makes the taskbar shortcut indicators edge-aware for Windows 11's top/bottom/left/right taskbar positioning.ShortcutGuide-Animated.mp4
Changes
Closes: #48435
Closes #48491
Closes: #49200
Closes: #48552 (theme flash on Light/System theme + shortcut-list scroll flutter)
Closes: #48773
Architecture
TransparentTintBackdropTransientSurfacecontrol for chrome (acrylic backdrop, theme shadow, rounded corners)Edge-aware taskbar indicators (Windows 11 top/bottom/left/right)
SHAppBarMessage/ABM_GETTASKBARPOSAPI (the same API CmdPal Dock uses)Visual polish
Robustness
Application.Current.Exit()on close)Validation