优化用于覆盖红绿灯按钮的Topit按钮在macOS26下的位置#41
Open
arnozxchen wants to merge 5 commits into
Open
Conversation
arnozxchen
commented
Jul 1, 2026
- 新增了一个方法用于实时获取目标窗口的红绿灯按钮位置
- 对于红绿灯位置可用的窗口,用公式
$x = axPosition.x - windowFrame.origin.x + axSize.width / 2$ ,$y = axPosition.y - windowFrame.origin.y + axSize.height/2$ 计算按钮中心位置;对于红绿灯位置不可用的窗口(如基于Electron应用:Feishu...),使用假设偏移来规整。
… detection - Add getCloseButtonLocalCenter() to read target window's close button position via AXUIElement, converting to overlay-local coordinates - Apply calculated offset to control button VStack in all three overlay views (OverlayView, OverlayView12, OverlayViewOpacity) - Graceful fallback: when AX close button is unavailable (Electron/ Java/custom windows), offset remains .zero preserving existing behavior
- Fix parenthesis bug in getCloseButtonLocalCenter: axSize.height/2 was outside the parentheses, causing Y offset to be off by full button height - Fix orphaned else block in OverlayViewOpacity.swift - Add print diagnostics in all overlay views to log AX detection results
- Fix Y formula: axPosition.y - windowFrame.origin.y + axSize.height/2 (AX close button position is screen top-left origin, subtract window origin) - Add estimated position fallback (20,20) for Electron apps where kAXCloseButtonAttribute returns .noValue (e.g. Feishu) - Fix escaped print statements (\\( → \() - Clean up duplicate fallback lines in OverlayView files
arnozxchen
marked this pull request as draft
July 1, 2026 08:47
- Add .allowsHitTesting(opacity != 0) to capture group so transparent overlay lets mouse events reach the underlying window while keeping control buttons clickable - Add mouse-leave detection in Timer as fallback for restoring overlay when onHover exit may be missed - Fix stopMouseMonitor() to synchronously close all auxiliary windows (screen covers + mask) by title filter, preventing orphaned mask windows from blocking the overlay after Cmd+P window selection - Reset mask and targetWindowID in stopMouseMonitor() to avoid stale state
arnozxchen
marked this pull request as ready for review
July 1, 2026 10:01
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.