surface UAC consent prompt in the foreground#5154
Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits intoJul 20, 2026
Merged
Conversation
Copilot started reviewing on behalf of
Gabriel Dufresne (GabrielDuf)
July 20, 2026 17:28
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Improves Windows UAC prompt foreground activation by coordinating the UI and elevation layers.
Changes:
- Adds a main-window activation delegate.
- Activates visible windows before cached elevation.
- Adds Windows foreground permission interop.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/UniGetUI.Core.Tools/Tools.cs |
Prepares foreground access before cached elevation. |
src/UniGetUI.Core.Data/CoreData.cs |
Exposes the UI activation delegate. |
src/UniGetUI.Avalonia/Views/MainWindow.axaml.cs |
Registers visible-window activation behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Marc-André Moreau (mamoreau-devolutions)
approved these changes
Jul 20, 2026
4 tasks
4 tasks
4 tasks
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 pull request improves how the application handles User Account Control (UAC) consent prompts on Windows, ensuring that the consent dialog appears in the foreground and is not hidden behind other windows. The main changes introduce a mechanism for the UI layer to bring the main window forward before a UAC prompt is shown, and update the elevation logic to support this behavior.
Foreground window activation for UAC prompts:
BringMainWindowToForegroundAsyncdelegate toCoreData, allowing the UI layer to expose a method for bringing the main window to the foreground before a UAC prompt is triggered. This ensures the consent prompt is not hidden behind other windows, especially when secure desktop is off.MainWindow.axaml.cs, setCoreData.BringMainWindowToForegroundAsyncto a method that brings the window forward only if it is currently visible, preventing the window from being shown unexpectedly if it's hidden in the tray.Tools.csto callBringMainWindowToForegroundAsync(if set) and then invoke the Windows APIAllowSetForegroundWindow, ensuring the consent dialog can take focus.AllowSetForegroundWindowand related constants to support the above logic.Code organization:
UniGetUI.Core.DatainMainWindow.axaml.csto support the new delegate.