Keep clipboard panel above full-screen apps - #52
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c2f223dd3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @objc private func handleApplicationActivation() { | ||
| guard window?.isVisible == true, !isDismissing else { return } | ||
| beginVisibilityRecovery() |
There was a problem hiding this comment.
Avoid reclaiming focus when another app activates
When the user switches applications with Cmd-Tab while the panel is open, this handler calls beginVisibilityRecovery(), which synchronously reaches restorePresentationPolicyAndOrdering() and panel.makeKey(). That can run before the deferred windowDidResignKey check, causing that check to see the panel as key again and abort its auto-hide, so Pesty steals focus back from the newly activated application. Application activation should only initiate reattachment after confirming the panel is detached, without immediately making it key.
Useful? React with 👍 / 👎.
| guard let self, | ||
| self.presentationGeneration == generation, | ||
| self.isDismissing else { return } |
There was a problem hiding this comment.
Resolve callbacks when presentation interrupts dismissal
If show() runs during the 80 ms hide animation, it increments presentationGeneration, so this guard discards the hide completion without removing or invoking hideCompletions. For pasteItem, that suppresses the requested paste, and the retained callback then executes during a later unrelated hide, potentially pasting the stale item into the previously captured application. An interrupted dismissal must explicitly cancel or complete its queued callbacks rather than leaving them for the next hide.
Useful? React with 👍 / 👎.
Summary
Verification