Skip to content

Add display-aware corner size cycling - #1962

Open
joseph-zhong wants to merge 2 commits into
rxhanson:mainfrom
joseph-zhong:feature/orientation-aware-corner-cycling
Open

joseph-zhong wants to merge 2 commits into
rxhanson:mainfrom
joseph-zhong:feature/orientation-aware-corner-cycling

Conversation

@joseph-zhong

@joseph-zhong joseph-zhong commented Nov 9, 2026 •

Copy link
Copy Markdown

Summary

Add a display-orientation mode that cycles corner widths on landscape displays and corner heights on portrait displays.

Before

Corner shortcuts used one global horizontal or vertical expansion axis on every display.

After

Corner shortcuts can select a third mode that expands horizontally on landscape displays and vertically on portrait displays; the two existing fixed-axis modes behave as before.

Highlights

  • Preserves the existing cornerCycleExpansionAxis preference key and its horizontal/vertical raw values for backwards compatibility.
  • Resolves the automatic mode from the destination display's visible frame.
  • Uses the same resolved axis for frame calculation, cooperative adjacent-window resizing, cycle matching, and move ordering.
  • Adds landscape/portrait behavior coverage and explicit legacy raw-value coverage.

Learnings

  • Rectangle already centralizes display-orientation detection in CGRect.isLandscape; this change reuses that convention.

Follow-ups

None.

Test Plan

From the repository root:

xcrun swiftc -parse Rectangle/**/*.swift RectangleTests/**/*.swift

Captured output: no output; exit 0.

jq empty Rectangle/Localizable.xcstrings

Captured output: no output; exit 0.

git diff --check origin/main...HEAD

Captured output: no output; exit 0.

GitHub Actions run 42659621500 ran the repository build command:

xcodebuild -project Rectangle.xcodeproj -scheme Rectangle archive CODE_SIGN_IDENTITY=- -archivePath build/Rectangle.xcarchive

Captured output:

** ARCHIVE SUCCEEDED **
** EXPORT SUCCEEDED **
created: /Users/runner/work/Rectangle/Rectangle/Rectangle.dmg
Artifact Build.zip successfully finalized. Artifact ID 13693648120

GitHub Actions run 42660531150 ran the focused tests:

xcodebuild test -project Rectangle.xcodeproj -scheme Rectangle -destination 'platform=macOS' CODE_SIGN_IDENTITY=- -only-testing:RectangleTests/HalfSplitCornerCalculationTests -only-testing:RectangleTests/CornerCycleExpansionModeTests

Captured output:

Test Suite 'CornerCycleExpansionModeTests' passed
Executed 2 tests, with 0 failures (0 unexpected)
Test Suite 'HalfSplitCornerCalculationTests' passed
Executed 47 tests, with 0 failures (0 unexpected)
Executed 49 tests, with 0 failures (0 unexpected)
** TEST SUCCEEDED **

MANUAL (not run; requires one landscape and one portrait display):

  1. Run the Debug build and grant Accessibility permission to com.knollsoft.Rectangle.debug.
  2. In Settings > Behavior, set Repeated commands to cycle sizes on side actions.
  3. Set Cyclic corner shortcuts expand to based on display orientation.
  4. On a landscape display, repeat each corner shortcut and verify only the window width cycles.
  5. Move the window to a portrait display, repeat each corner shortcut, and verify only the window height cycles.
  6. Select horizontally, then vertically, and verify each fixed mode still uses the selected axis on both displays.

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