fix: unminimize Ghostty window before raising on focus#340
Merged
Conversation
Root cause: focus_window doesn't unminimize — AXRaised + activate_app don't undo kAXMinimizedAttribute set by kild hide. Need to add UnminimizeAndRaise action that sets kAXMinimized=false before raising.
After the Core Graphics migration (#286), `kild focus` could not restore a window previously minimized via `kild hide` because the AX API focus path only raised the window without unsetting kAXMinimizedAttribute. Changes: - Add UnminimizeAndRaise variant to WindowAction enum - Add ax_unminimize_and_raise_window function mirroring existing pattern - Check is_minimized in focus_window and unminimize before raising - Add test for new WindowAction variant Fixes #289
Owner
Author
Automated Code ReviewSummaryThe fix correctly implements the unminimize-before-raise sequence for Ghostty windows. Code follows established codebase patterns with proper AX API memory management. Strengths
Suggestions (non-blocking)
Security
Checklist
Self-reviewed |
Add dedicated focus_unminimize_failed log event to distinguish unminimize failures from general AX raise failures — helps debug Ghostty AX quirks. Replace array length test with exhaustive match test for WindowAction variants, providing stronger compile-time guarantees.
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.
Summary
After the Core Graphics migration (#286),
kild focuscould not restore a window previously minimized viakild hide. The AX API focus path only raised the window without unsettingkAXMinimizedAttribute, so hidden windows stayed in the Dock.Root Cause
focus_window()inmacos.rscalledax_perform_raise()which only setsAXRaised/AXMainattributes — neither undoes minimize. Theis_minimizedfield was tracked inNativeWindowInfobut never checked or acted upon in the focus path.Changes
crates/kild-core/src/terminal/native/macos.rsUnminimizeAndRaisevariant toWindowActionenumcrates/kild-core/src/terminal/native/macos.rsax_unminimize_and_raise_window()functioncrates/kild-core/src/terminal/native/macos.rsis_minimizedinfocus_window()and unminimize before raisingcrates/kild-core/src/terminal/native/macos.rsWindowActionvariantTesting
cargo fmt --checkpassescargo clippy --all -- -D warningspassescargo test --allpasseskild hide branch→kild focus branchrestores window from DockValidation
Issue
Fixes #289
Implementation Details
Implementation followed artifact:
.claude/PRPs/issues/issue-289.mdDeviations from plan:
None