Skip to content

Add an option to snap before reaching outer screen edges - #1901

Merged
rxhanson merged 3 commits into
rxhanson:mainfrom
kiteretsu903:fix/review-early-edge-snap
Oct 14, 2026
Merged

rxhanson merged 3 commits into
rxhanson:mainfrom
kiteretsu903:fix/review-early-edge-snap

Conversation

@kiteretsu903

@kiteretsu903 kiteretsu903 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Adds the off-by-default “Snap before reaching screen edges” option. When enabled, an outer edge can activate its snap target within a configurable distance of the edge (20 points by default), so the pointer does not have to reach the physical boundary.

Corner targets retain their existing detection. Shared edges between displays retain their existing trigger margin so that moving a window between displays does not gain an early snap zone. This is checked along the shared portion of an edge, including displays with different sizes or offsets. On exposed outer edges, a positive early-snap distance overrides the configured snapEdgeMargin values, including larger margins.

The change is confined to SnapEdgeDetection and its setting. It does not change the resulting window size, placement, animation, or Layout Helper behavior. The toggle writes 20 when enabled and 0 when disabled. The stored value is a double, so users can choose a custom distance with defaults write com.knollsoft.Rectangle snapBeforeReachingEdges -float 30 and restart Rectangle. Opening settings or importing configuration preserves custom distances. With the option disabled, the original edge margins apply.

Validation

The full branch XCTest suite passed (578 tests, including existing tests), covering fractional distances, override precedence, shared-boundary decisions, toggle behavior, and custom-distance preservation during settings synchronization and configuration import. A physical multi-display drag pass, including crossing partially shared edges and corner behavior, remains pending.

This replaces the corresponding part of #1892.

@kiteretsu903
kiteretsu903 force-pushed the fix/review-early-edge-snap branch 2 times, most recently from 06c9dd1 to 6269df1 Compare October 10, 2026 02:51
@rxhanson

Copy link
Copy Markdown
Owner

A couple of improvements:

  • Replace the Bool default with a double, and that will be the earlyDistance. We can still keep the toggle instead of a numerical input, and when it gets toggled it will set the default 0 or 20 if disabled or enabled, respectively. This way people can adjust this value using a defaults command if desired.
  • It would be odd logic to apply this on top of the existing snapEdgeMargin defaults. I think it should override the snapEdgeMargin defaults if both are set.

@kiteretsu903

Copy link
Copy Markdown
Contributor Author

A couple of improvements:

  • Replace the Bool default with a double, and that will be the earlyDistance. We can still keep the toggle instead of a numerical input, and when it gets toggled it will set the default 0 or 20 if disabled or enabled, respectively. This way people can adjust this value using a defaults command if desired.
  • It would be odd logic to apply this on top of the existing snapEdgeMargin defaults. I think it should override the snapEdgeMargin defaults if both are set.

Yep! Both make sense to me. Will apply the fixes

@kiteretsu903
kiteretsu903 force-pushed the fix/review-early-edge-snap branch from 6269df1 to f38a130 Compare October 13, 2026 01:35
@rxhanson
rxhanson merged commit 7bda164 into rxhanson:main Oct 14, 2026
1 check passed
AkiyamaKunka added a commit to AkiyamaKunka/Rectangle that referenced this pull request Oct 16, 2026
The option added in rxhanson#1901 is a Swift literal that the catalog had not
picked up yet, so the Snap Areas tab showed it in English (as noted in
the review). Adds the key with its Simplified Chinese value.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
rxhanson pushed a commit that referenced this pull request Oct 17, 2026
* Complete the Simplified Chinese (zh-Hans) localization

Fill in the 180 zh-Hans strings that were missing from Localizable.xcstrings
and Main.xcstrings (the 2026 additions: eighths/ninths/twelfths/sixteenths,
stacked windows, tiling, mouse button shortcuts, the modernized settings UI),
re-validate the 16 entries marked needs_review against their updated English
source, and stop translating the app name "Spectacle" (it was rendered as the
word for "magnifying glass").

Grid positions follow the scheme already used for sixths: three-column grids
use 左/中/右 + 上/中/下, four-column grids use the row (上排/中排/下排,
中上排/中下排) followed by the column (左/中左/中右/右), and the full-height
vertical eighths are 竖向1/8(第 N 列).

Both catalogs are written in Xcode's own string-catalog layout, so the diff
only adds and updates zh-Hans entries.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* Add zh-Hans for the new "Snap before reaching screen edges" toggle

The option added in #1901 is a Swift literal that the catalog had not
picked up yet, so the Snap Areas tab showed it in English (as noted in
the review). Adds the key with its Simplified Chinese value.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
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.

2 participants