Skip to content

✨ Improved snapping on left, right, and bottom edges#1068

Merged
MrKai77 merged 6 commits intoMrKai77:developfrom
jvanderen1:jvanderen1-vertical-snapping
Mar 22, 2026
Merged

✨ Improved snapping on left, right, and bottom edges#1068
MrKai77 merged 6 commits intoMrKai77:developfrom
jvanderen1:jvanderen1-vertical-snapping

Conversation

@jvanderen1
Copy link
Copy Markdown
Contributor

Description

Adds Rectangle-style vertical snapping to WindowDirection+Snapping.swift. When dragging a window to the left, right, or bottom screen edge, snap zones now include corners, halves, thirds, center thirds, and two-thirds cycling — providing full coverage of all tiling options via drag-to-snap.

Fixes #1066

Changes

  • Left/Right edges now have 7 vertical zones (by mouse Y position): corner quarters (~1%), top/bottom half (~1–6.3%), top/bottom vertical third (6.3–33%), and a center zone that defaults to verticalCenterThird with topTwoThirds/bottomTwoThirds cycling
  • Bottom edge now has the same 7-zone layout applied horizontally: corner quarters, left/right half, left/right third, and horizontalCenterThird with leftTwoThirds/rightTwoThirds cycling
  • Consolidated processLeftSnap, processRightSnap, and processBottomSnap into a single generic processEdgeSnap function with an EdgeZoneDirections configuration struct, eliminating code duplication
  • Zone thresholds for corners (1/95) and halves (6/95) are derived from measurements of Rectangle's snapping behavior

How has this been tested?

macOS (Sequoia 15.3.2)

Tested drag-to-snap on all three edges (left, right, bottom), verifying each of the 7 zones returns the correct WindowDirection:

  • Verified two-thirds cycling works when dragging from a third zone into the center zone
  • Left edge: corner quarters, topHalf, topThird, verticalCenterThird, bottomThird, bottomHalf zones
  • Right edge: corner quarters, topHalf, topThird, verticalCenterThird, bottomThird, bottomHalf zones
  • Bottom edge: corner quarters, leftHalf, leftThird, horizontalCenterThird, rightThird, rightHalf zones
  • Center zone two-thirds cycling (e.g. topThird → drag to center → topTwoThirds)
  • Top edge behavior unchanged (topHalf at edges, maximize in center)

Video Demos

Snapping.Left.and.Right.mp4
Snapping.Bottom.mp4

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in this PR.

Please describe to which degree, if any, an LLM was used in creating this pull request.

I used Claude Opus 4.6 (Thinking) to help develop the snapping zone logic, zone thresholds, EdgeZoneDirections consolidation pattern, and code structure. All changes were reviewed and tested manually.

@jvanderen1 jvanderen1 changed the title ✨ Improved snapping on left, right, and bottom ✨ Improved snapping on left, right, and bottom edges Mar 15, 2026
Comment thread Loop/Window Management/Window Action/WindowDirection+Snapping.swift Outdated
@MrKai77
Copy link
Copy Markdown
Owner

MrKai77 commented Mar 16, 2026

Otherwise great work! This is totally a great start on adding more actions to window snapping! Just want to make sure we don't introduce any significant breaking changes for existing users, such as the halves I mentioned above.

@jvanderen1 jvanderen1 force-pushed the jvanderen1-vertical-snapping branch from a99004b to b6ed787 Compare March 16, 2026 06:50
@jvanderen1
Copy link
Copy Markdown
Contributor Author

jvanderen1 commented Mar 16, 2026

@MrKai77 I appreciate the feedback provided! I agree that minimizing breaking changes would minimize risk for our current users. I don't know if this application has ever put proposed changes behind an experiment, but that may be helpful (or a separate configuration).

I think it would also be helpful for you or other users to try this out before submitting. I am able to build and run this myself, but if possible, I would like user feedback from folks actually trying it out.

Happy to take further feedback!

P.S. another side comment, I do notice that dragging against the top edge takes a really long time to compute compared to other edges. You can see my cursor struggling on the top edge in the new video snippets. Any known reason for this?

@jvanderen1 jvanderen1 force-pushed the jvanderen1-vertical-snapping branch from b6ed787 to ac02046 Compare March 16, 2026 07:06
Copy link
Copy Markdown
Owner

@MrKai77 MrKai77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working really well actually!

On the experiment point: we sometimes tuck more advanced features behind the Advanced tab or a defaults write flag to keep them out of reach for most users, but I don’t think that’s necessary here.

I’ve tested this locally and it feels very smooth. I’ll also tag @SenpaiHunters to give it a try if possible. Once merged, this will roll into Loop’s development build, where a few hundred beta testers can provide additional feedback before it reaches stable.

Regarding your side note: the issue is likely caused by this line:

CGWarpMouseCursorPosition(newOrigin)

You can also mitigate it by disabling “Suppress Mission Control” in Loop’s settings.

Overall, this is looking fantastic, really appreciate the work here :)

Comment thread Loop/Window Management/Window Action/WindowDirection+Snapping.swift
@jvanderen1 jvanderen1 requested a review from MrKai77 March 21, 2026 23:43
@MrKai77 MrKai77 merged commit 52de4c7 into MrKai77:develop Mar 22, 2026
1 check passed
@jvanderen1 jvanderen1 deleted the jvanderen1-vertical-snapping branch March 22, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Support Tiling windows by thirds vertically

2 participants