Repository navigation
fix(hub): a tree opened in a program comes to the front on Windows - #183
Merged
Merged
Conversation
The hub runs in the background, and Windows lets a background process neither take the foreground nor give it: Explorer, the terminals, the editors and Orca opened behind the browser that asked for them. The folder dialog's owner window (a synthetic Alt key event, then SetForegroundWindow) moves to `foreground::Front`, which also lets any process take the foreground next (AllowSetForegroundWindow(ASFW_ANY)). `open::open` holds one while it starts the program or hands it the link. ADR-0046's consequence is amended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Problem
When you open a stack's or lane's tree in a program (Explorer, Windows Terminal, PowerShell, VS Code and its forks, Claude, Orca), the window opens behind the browser. The hub runs in the background, and Windows lets a background process neither take the foreground nor give it. ADR-0046 named this as a consequence.
Fix
dialog.rsto a newforeground::Front. It is an invisible topmost window brought to the front with a synthetic Alt key event and thenSetForegroundWindow. It now also callsAllowSetForegroundWindow(ASFW_ANY), so the next process to ask may take the foreground. That permission lasts until the user's next input. It covers both a program the hub starts and a running program a link is handed to (VS Code, Orca).open::openholds aFrontwhile it starts the program or hands it the link.Linux is unchanged. A desktop there that prevents focus stealing may still open the program behind.
Tests
cargo clippy -p devstack-hub --all-targets -- -D warningsandcargo fmt --checkpass.cargo test -p devstack-hub --lib openpasses.🤖 Generated with Claude Code