Skip to content

Conversation

@mogenson
Copy link
Contributor

The mouse cursor moves in a straight line between its current position and the destination set with hs.mouse.absolutePosition(). If the mouse is moving to a new screen, it can get caught on a corner that does not connect between screens, depending on the screen sizes and layout.

When moving the mouse between screens, first move the mouse to the center of the current screen, then to the center of the new screen, then the target destination. This path has the best chance at avoiding any non-connected edges between screens.

These extra mouse movements happen instantaneously and are not visible to the user.

The mouse cursor moves in a straight line between its current position
and the destination set with hs.mouse.absolutePosition(). If the mouse
is moving to a new screen, it can get caught on a corner that does not
connect between screens, depending on the screen sizes and layout.

When moving the mouse between screens, first move the mouse to the
center of the current screen, then to the center of the new screen, then
the target destination. This path has the best chance at avoiding any
non-connected edges between screens.

These extra mouse movements happen instantaneously and are not visible
to the user.
@mogenson
Copy link
Contributor Author

Note, this approach may still fail for more complex screen layouts (like three monitors in an "L" shape). But should be suitable for the majority of users and doesn't require any sophisticated mouse cursor route planning.

@cmsj cmsj merged commit 006b095 into Hammerspoon:master May 12, 2025
1 check passed
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