CmdPal: add support for compact mode#48801
Open
zadjii-msft wants to merge 20 commits into
Open
Conversation
- HotReloadSettings now recomputes the card-height clamp for the current expanded state instead of forcing it off, so unrelated setting changes no longer let a centered compact palette overflow the work area. - UpdateRegionsForCustomTitleBar clears stale caption/passthrough regions and the HWND clip when the card isn't measurable, instead of leaving old hit-test zones behind. - ComputeExpandedCardMaxHeightDip falls back to a screen-bounded height (not PositiveInfinity) when available space is <= 0, keeping the clamp. - Uncloak() checks the DwmSetWindowAttribute HRESULT before flipping IsVisibleToUser, matching Cloak(). - Renamed MainWindow.HandleExpandCompactOnUiThread to ApplyCompactCardHeightClampOnUiThread to clarify it owns card sizing, not the semantic compact state (ShellViewModel.ExpandedMode). - Scoped the post-expand select suppression to the specific page that the expand realized so it can't leak across rapid navigation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pact-cmdpal-review
Contributor
michaeljolley
requested changes
Jun 24, 2026
michaeljolley
left a comment
Contributor
There was a problem hiding this comment.
Can't wait to use this. Couple Dispose methods that look like they weren't finished, but otherwise, great.
|
|
||
| public void Dispose() | ||
| { | ||
| throw new NotImplementedException(); |
|
|
||
| public void Dispose() | ||
| { | ||
| throw new NotImplementedException(); |
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.



This is a bear of a PR. Watch out.
This PR adds support for compact mode to the command palette. In compact mode, the results of the command palette window are collapsed by default. And the only thing that is visible is the search bar. When the user types, the window is expanded only just enough to show the available results1
cmdpal-compact-pr-000.mp4
This is made possible by a fairly annoyingly substantial refactoring to how our windowing is done. Animating the size or bounds of an HWND on Windows is not fun. With pretty much any XAML application, you're going to get at least one frame of blackness when you resize your window. The trick then is to create an experience where it looks like your application is resizing, but the HWND never actually resizes.
So the main bulk of this PR is actually just refactoring our window handling. Our
MainWindowclass now becomes a dummy holder of some content, and most of the main content is moved into theCmdPalMainControlclass.MainWindow's job then is to handle a transparent window that hosts some XAML content inside of it, and pretend that content is the real bounds of the window. We need to fake our NCHITTEST results, so that the edges of the XAML content act like they're the edge of the actual HWND. We need to hide our actual window frame and shadow, but then also re-create them in XAML around our content.Previously we've done work like this using a single full screen transparent window with XAML content inside of it. However that has the downside of not allowing the XAML content to be movable across different monitors. By faking out the NCHITTEST results, we allow users to resize and move the window using the normal user32 move size loop.
Our HWND is also cropped (with SetWindowRgn to the bounds of the shadow around our XAML content. We need to include the shadow in the hit testable region, because if we don't, then the shadow will be visibly cropped on the edges.
In compact mode, instead of centering our window in the middle of the monitor, the user can set a relative height where the search box opens on that monitor. This defaults to about 60% up from the bottom of the monitor, so that there's room for the results to expand downwards and feel centered within the screen. This position is a setting, so users can customize it to whatever they like.
I've also added a developer only debug build only internal setting, which allows you to see the actual frame of our HWND. This makes it easier to visually debug where the bounds of the window are and understand a little bit more about the layout of our application. This setting and functionality is disabled in release builds.
Closes #38423
Footnotes
with some caveats: pages with details expand fully always. ↩