Add overlap offset for grid position cycling#1762
Open
MyronKoch wants to merge 9 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When cycling through grid positions (sixths, eighths, ninths, twelfths, sixteenths, or quarters with quadrant cycling mode), windows that land on a position already occupied by another window now receive a small offset so the user can see there is a window underneath. The feature is off by default and enabled via hidden preference: defaults write com.knollsoft.Rectangle cyclingOverlapOffset -bool true Configurable options: - cyclingOverlapOffsetSize (default 11pt) controls the offset distance - cyclingOverlapMaxCascade (default 1) controls max cascade layers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add "Offset cycling position on overlap" checkbox to the Grid Positions section of the extra settings popover - Apply overlap detection to all window actions, not just cycling - Match on origin point instead of exact frame, so mixed sizes at the same grid position (e.g. quarter + eighth) trigger the offset Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Show a live count badge when the mouse hovers over a grid position with multiple stacked windows. Uses timer-based polling (200ms) of NSEvent.mouseLocation for reliable hover detection that survives sleep/wake cycles. The count is queried live via Accessibility APIs on each hover, so it always reflects the current window state. Also updates default offset to 11pt and changes overlap detection to origin-point matching for mixed-size windows at the same grid position. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Re-add positionCycles guard to skip AX enumeration on non-grid actions (maximize, restore, center, etc.) - Guard overlapOffset <= 0 to prevent silent no-op or corner-shoving - Cap maxCascade at 5 to prevent spin loops with extreme values - Cap stackedRegions at 20 entries to prevent unbounded growth - Call OverlapCountBadge.clearAll() when feature is toggled off - Add three new defaults to Defaults.array for config export/import - Remove imageHugsTitle from checkbox (no-op on standard checkboxes) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
23 tests covering: - positionCycles property: grid actions return true, non-grid false - OverlapCountBadge: record, deduplicate, remove, clearAll, max cap - screenFlipped: self-inverse property, null handling, negative coords - Defaults.array: all 3 overlap prefs included for config export - Offset guards: maxCascade clamping, screen boundary clamping on primary and secondary monitor coordinate spaces Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The overlap count badge (OverlapCountBadge.swift) has architectural issues with stale window state tracking that cause incorrect badge positioning and counts. The core overlap offset feature is solid and well-tested independently. The badge will be reworked and submitted as a separate PR. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
|
Looks good, I like it! I'm going to test it out a little bit more and if I don't hit any snags I'll go ahead and merge. I've been thinking about adding a feature where you can cycle the windows stacked on top of each other, and this would fit nicely with that concept. Looking forward to the hover count badge idea if that one comes in a follow-on. |
Invert the logic: instead of listing which actions cycle, exclude the non-positional actions (maximize, restore, center, move, resize, display changes). This ensures halves, thirds, fourths, quarters, and all grid sizes get overlap detection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
cyclingOverlapOffsetSize(default 11),cyclingOverlapMaxCascade(default 1, max 5)Motivation
On large displays (4K TVs, ultrawides) with fine-grained grid positions (ninths, twelfths, sixteenths), placing a window at a position occupied by another window completely hides the window underneath with zero visual indication. This is especially common on multi-monitor setups where many windows share grid positions across workflows.
Implementation details
WindowManager.applyOverlapOffsetIfNeeded- core overlap detection and offset logic, gated behindpositionCyclesto avoid unnecessary AX enumeration on non-grid actionsDefaults.arrayfor config export/importTest plan