Repository navigation
Keep minimized windows in the Dock when the global hotkey reveals cmux - #18533
Conversation
Two cases the suite missed, both driven through toggleApplicationVisibility with the application in the background and not hidden, which is the state the global hotkey fires from: - a visible window alongside a minimized one must reveal only the visible one and leave the minimized one in the Dock (fails today); - with every window minimized the hotkey must still restore them, so the fix for the first case cannot simply drop minimized windows from the reveal set and leave the hotkey inert. Co-authored-by: Austin Wang <austinwang115@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012gWLE61zVSnNbkTq5DDjHC
Minimizing a window is an explicit "put this away" that only the user undoes. The global hotkey ignored that: with cmux in the background and not hidden, showApplicationWindows revealed every window that was visible *or* miniaturized, so each press dragged minimized windows back out of the Dock. Reveal now targets only on-screen windows, matching the hidden-application path and iTerm. Minimized windows stay reachable as a last resort. When nothing else can be shown they are still the reveal targets, in both the hidden and the background branch -- otherwise reveal would return early on an empty target list and never activate, leaving the hotkey inert while every window is minimized. Fixes manaflow-ai#9991. Co-authored-by: Austin Wang <austinwang115@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012gWLE61zVSnNbkTq5DDjHC
|
All contributors have signed the CLA ✍️ ✅ |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe global hotkey treats visible windows as ordinary reveal targets and leaves miniaturized windows untouched when visible targets exist. It uses miniaturized windows as a fallback when other targets are unavailable. ChangesWindow reveal behavior
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to The change is ready for normal CI validation before merging. 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
showApplicationWindows falls back to minimized windows in two places: the hidden-application branch and the background branch. Only the second was exercised. Nothing reached the first -- the hidden-application tests all supply either captured or soft-dismissed restore targets, and the one test that hides the application and deminiaturizes goes through focus() instead. Covers hiding with Cmd-H and then pressing the hotkey while every window is minimized. Co-authored-by: Austin Wang <austinwang115@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012gWLE61zVSnNbkTq5DDjHC
|
Thank you @jacob-carlborg! :D |
|
Merge receipt for |
29661b9 gh-merge-green: allow explicit Vercel status override (manaflow-ai#18614) dd6e295 fix: preserve SSH ProxyCommand child environment (manaflow-ai#18285) f0a2bad Reject invalid Python regression-lane timeouts (manaflow-ai#18476) 3430354 Preserve PR media referenced through GitHub blob URLs (manaflow-ai#18562) 3b71b41 Reset a browser pane's selected frame and element refs when the page navigates (manaflow-ai#18577) 04e1d68 Clear force-close bypass when a confirmed close is rejected (manaflow-ai#18414) 8d86447 Treat Copilot value flags as value options when restoring (manaflow-ai#18470) f6c678a Keep __proto__ keys in whole-area browser storage reads (manaflow-ai#18527) 7e97128 Keep minimized windows in the Dock when the global hotkey reveals cmux (manaflow-ai#18533)
Summary
With cmux in the background but not hidden, the system-wide show/hide hotkey pulled minimized windows back out of the Dock along with the on-screen ones. Minimizing a window is an explicit "put this away" that only the user undoes, and other Mac terminals leave those windows alone. After this change the hotkey reveals only on-screen windows, which is what the hidden-application path already did.
showApplicationWindowschosevisible || miniaturizedfor the background branch; it now chooses on-screen windows only (visible && !miniaturized). Minimized windows stay reachable as a last resort: when nothing else can be shown, both the hidden and the background branch fall back to them throughminiaturizedTargetsOfLastResort. That fallback is load-bearing — without it the hotkey goes completely inert while every window is minimized, becauserevealreturns early on an empty target list and never callsactivate.@austinywang diagnosed this first in #10688 and converged on the same shape there before it was closed; both commits here carry his
Co-authored-by.Fixes #9991.
Testing
Two Swift Testing cases added in
cmuxTests/MainWindowVisibilityLifecycleTests.swift, both driven throughtoggleApplicationVisibilitywithisApplicationActive: { false }andisApplicationHidden: { false }— the state the global hotkey actually fires from:backgroundHotkeyLeavesMiniaturizedWindowsInTheDock— a visible window alongside a minimized one. Asserts the application activates, the visible window is made key, and the minimized one is never deminiaturized. This is the reported symptom.backgroundHotkeyRestoresMiniaturizedWindowsWhenNothingElseCanBeShown— every window minimized. Asserts the application still activates and both windows are restored, so the first fix cannot be satisfied by dropping minimized windows from the reveal set and leaving the hotkey dead.The existing
testShowApplicationWindowsStillRestoresMiniaturizedWindowsWhenNoHiddenTargetsWereCapturedpasses unchanged; it covers the same fallback throughshowApplicationWindowsdirectly.python3 scripts/verify-local.py— 17/17 selected checks pass../scripts/test-unit.sh -derivedDataPath ~/Library/Developer/Xcode/DerivedData/cmux-hotkeymin-tests build-for-testing—** TEST BUILD SUCCEEDED **at both commits.Test execution is pending in CI: the
cmuxTestshost is the app itself, and this repo's instructions rule out launching an untaggedcmux DEV.applocally, so the red/green receipts come fromscripts/run-e2e.sh cmuxTests/MainWindowVisibilityLifecycleTestsat the test-only commit and at the fix commit. I'll post both run links here.Changelog
Fixed: The system-wide show/hide hotkey no longer pulls minimized windows out of the Dock
Proof
No visual change — the behavior is whether a window stays in the Dock. The two added tests are the oracle; a dogfood build can be requested with the
dev-buildlabel if a reviewer wants to feel it.Checklist
cmux ssh— n/a🤖 Generated with Claude Code
https://claude.ai/code/session_012gWLE61zVSnNbkTq5DDjHC
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes the global show/hide hotkey pulling minimized windows back out of the Dock when cmux is in the background but not hidden. Revealing now targets on-screen windows only. Fixes #9991.
Written for commit 6876194. Summary will update on new commits.
Note
Medium Risk
Changes core window-restore logic for the global hotkey path; behavior is well-covered by new tests but affects activation and focus whenever users toggle visibility.
Overview
Fixes the global show/hide hotkey undeminiaturizing windows when cmux is in the background but not hidden.
showApplicationWindowsnow prefers on-screen windows (visible && !miniaturized) instead of treating minimized windows as normal reveal targets.Minimized windows are restored only via
miniaturizedTargetsOfLastResortwhen nothing else can be shown (hidden app with no captured/dismissed targets, or background with no visible or dismissed windows), so the hotkey still activates instead of no-oping when every window is minimized.Adds lifecycle tests for the hidden-app fallback and the two background hotkey cases (mixed visible/minimized vs all minimized).
Reviewed by Cursor Bugbot for commit 6876194. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit