Skip to content

Add option to move resized window to the display under cursor.#1644

Merged
rxhanson merged 1 commit intorxhanson:mainfrom
fnando:move-resize-to-cursor-display
Sep 29, 2025
Merged

Add option to move resized window to the display under cursor.#1644
rxhanson merged 1 commit intorxhanson:mainfrom
fnando:move-resize-to-cursor-display

Conversation

@fnando
Copy link
Copy Markdown
Contributor

@fnando fnando commented Sep 17, 2025

Divvy has a nice feature where it moves the resized window to the display under cursor. I added a similar feature that's opt-in.

CleanShot 2025-09-17 at 11 40 36

PS: Xcode 26 changed some positioning and is giving a few warnings. I didn't know how you'd like to handle it, so I kept it as it is (you can see the buttons are broken on the image above; same on the initial screen asking for the shortcut profile).

Copy link
Copy Markdown
Owner

@rxhanson rxhanson left a comment

Choose a reason for hiding this comment

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

Thanks for contributing!

I'll take a look at those layout issues - thanks for pointing that out.

return UsableScreens(currentScreen: sourceScreen, adjacentScreens: adjacentScreens, numScreens: screens.count, screensOrdered: screensOrdered)
}

func detectScreensAtCursor() -> UsableScreens? {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Let's remove all of the comments in this function.

screens = UsableScreens(currentScreen: screen, numScreens: 1)
} else {
screens = screenDetection.detectScreens(using: frontmostWindowElement)
// Use cursor position or window position based on user preference
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Let's remove this comment as well, and change this if else to a ternary:

screens = Defaults.useCursorScreenDetection.enabled
? screenDetection.detectScreensAtCursor
: screenDetection.detectScreens(using: frontmostWindowElement)

@rxhanson
Copy link
Copy Markdown
Owner

I finally had a chance to test this one out, and we'll also want to properly handle next/prev display commands. With your changes, executing those repeatedly will land the window only on the other display and it won't go back. I think my expected behavior would be for those to not use the cursor display as the main display.

@rxhanson rxhanson force-pushed the move-resize-to-cursor-display branch from 1da0786 to 0bba832 Compare September 29, 2025 04:29
@rxhanson rxhanson merged commit 0bba832 into rxhanson:main Sep 29, 2025
1 check passed
@rxhanson
Copy link
Copy Markdown
Owner

I went ahead and made the changes I had recommended. Because the actions that move to other displays weren't ironed out, I left the checkbox hidden by default (only enabled via Terminal command). If you get a chance to fix up the other display edge cases, make another PR and we can add the checkbox back in.

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