Skip to content

Fix false positive overlap detection for half/third actions#1766

Open
MyronKoch wants to merge 1 commit into
rxhanson:mainfrom
MyronKoch:fix/overlap-false-positive
Open

Fix false positive overlap detection for half/third actions#1766
MyronKoch wants to merge 1 commit into
rxhanson:mainfrom
MyronKoch:fix/overlap-false-positive

Conversation

@MyronKoch
Copy link
Copy Markdown
Contributor

Summary

Fixes the post-merge bug from #1762 where executing a left or right half would add an offset even when there is no underlying window at that position.

Root cause

The overlap detection used origin-only matching (within 4px tolerance). When snapping to left-half at origin (0, 0), any other window on screen with its origin near (0, 0) - such as a maximized window - triggered a false positive.

Fix

Now requires that the other window fits within the candidate's dimensions: origins must match AND the other window must be the same size or smaller. This prevents a maximized window (1920x1080) from triggering the offset on a left-half (960x1080), while still detecting an eighth (480x540) behind a quarter (960x1080) at the same grid position.

Test cases

  • Two left-halves at same position - offset triggers (correct)
  • Eighth behind quarter at same origin - offset triggers (correct)
  • Maximized window behind left-half - NO offset (fixed)
  • Right-half vs left-half - NO offset (correct, different origins)

@MyronKoch MyronKoch marked this pull request as draft May 25, 2026 16:13
Origin-only matching caused false positives when a larger window
(e.g. maximized or near-fullscreen) shared the same origin as the
target position. Now excludes windows that cover more than 90% of
the screen on both axes from overlap detection, while preserving
offset behavior for mixed-size grid windows at the same position
(e.g. an eighth behind a quarter).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MyronKoch MyronKoch force-pushed the fix/overlap-false-positive branch from ec1d023 to 38eca47 Compare May 25, 2026 17:14
@MyronKoch MyronKoch marked this pull request as ready for review May 25, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant