Switch to minimized window in a single call via unified bring_window_to_top logic#96
Merged
Jeomon merged 1 commit intoCursorTouch:mainfrom Mar 10, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where switching to a minimized window via the App tool's switch mode required two calls — the first only restored the window from minimized state without bringing it to the foreground. The fix consolidates the two code branches into a single call to the existing bring_window_to_top method, which already handles both restoring and focusing.
Changes:
- Replaced the branched minimize-check-then-restore/focus logic in
switch_appwith a singlebring_window_to_topcall, retaining thewas_minimizedflag only for the user-facing message.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
Thanks pointing it out |
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 using the
Apptool inswitchmode to focus a minimized window (e.g., Zoom Workplace), the previous logic only restored the window from its minimized state — it did not bring it to the foreground. A second call to the same tool was required to actually switch focus to the window.video.mp4
This happened because the original code branched on
IsIconic:ShowWindow(SW_RESTORE)only (no focus change)bring_window_to_top(which both restores and focuses)Fix
Consolidated the two branches into a single unified call to
bring_window_to_top, which already handles the minimized case internally by callingShowWindow(SW_RESTORE)before setting the window as foreground. Thewas_minimizedflag is retained solely for generating a descriptive return message.bring_window_to_topalready contains the restore-then-focus sequence:Result
Switching to a minimized window now works correctly in a single tool call — the window is both restored from minimized state and brought to the foreground atomically.
Thanks for building such a useful MCP server! Hope this small fix improves the experience.