Repository navigation
Move window to the display under the cursor - #1913
Conversation
9dcb43a to
06f0fa6
Compare
|
Thanks for working on this! The Some quick background: There are a few files in Rectangle where all logic flows through, and they are the easiest places for changes to accumulate. The |
|
@Kiizon I added my testing feedback to the issue. |
Show the cursor screen detection toggle as "Move window to display where cursor is" under Across Display Settings, instead of only when the hidden default is already on. Test helpers now pin the cursor screen detection setting, so the display cycle tests no longer depend on the machine's own preferences.
06f0fa6 to
a756859
Compare
# Conflicts: # Rectangle/Managers/ShortcutManager.swift # Rectangle/WindowHistory.swift # Rectangle/WindowManager.swift # RectangleTests/RectangleTests.swift
|
At long last, I refactored the |
Closes #1908.
What it does
How
WindowHistorykeeps, for each window's last command, the frame of the display that was under the cursor and the shortcut that was pressed (which can differ from the action it resulted in, e.g. Left becoming the right half when crossing displays).WindowManagerandShortcutManagercompare the display with the one under the cursor now. If the cursor hasn't changed displays and the same shortcut was pressed, the command works from the window's display, the same as with the setting off. Otherwise it starts on the cursor's display. This doesn't depend on the last recorded action, which Rectangle forgets whenever an app adjusts the frame it was given (common when moving across displays).When Rectangle moves the cursor, it records the destination display, so its own cursor moves don't end a repeat. Cursor moves go through
warpCursor(to:)so tests can stub them.Tests
withExecutionSettingsnow pinsuseCursorScreenDetection, so the existing display-cycle test doesn't pick up the machine's own setting.All 581 tests pass. Note: I built and tested with Xcode 26.0.1, using local-only changes (old app icon, macOS 14 deployment target, no macOS 27 menu API) that aren't part of this PR. It hasn't been built with Xcode 27.