Skip to content

Conversation

@rygwdn
Copy link
Contributor

@rygwdn rygwdn commented Feb 14, 2025

When screens on macos have different physical sizes, macos will only allow the mouse to move between the screens where it thinks they overlap
image

This change bumps the cursor to the vertical middle of the edge of the screen before using relative movement to bump it onto the next display, making it much more likely that the cursor will be able to cross. The jump is sometimes noticeable, but it is pretty quick.

Should this be configurable?

@eltariel
Copy link
Contributor

Using the vertical middle should be significantly more reliable in most cases than just attempting to move across the border at the current pointer location. I've had similar thoughts about this: #56 (comment)

I think there needs to be a toggle for this. It's more distracting than helpful if you've got two screens with the same resolution that line up nicely, but there are also cases where it is completely broken:

  • If you have a tiny screen top-aligned next to a huge screen, you can only switch at the midpoint on the smaller screen
  • If you do something odd like align the bottom third of one monitor with the top third of another, there is no Y position that you can jump to that will let you switch in both directions (I know people who do this because it matches their physical screen layout 🤷)

If we want it to work reliably without having to configure screen edges there may be a trick we can use by moving diagonally but I keep thinking of ways that would break too 🤦

@hrvach
Copy link
Owner

hrvach commented Feb 25, 2025

This is a good idea, we'll try adding a flag too. Apologies for the delay, traveling for work.

@rygwdn
Copy link
Contributor Author

rygwdn commented Feb 25, 2025

I thought about adding something like the offsets that are available when switching between outputs (top & bottom of each monitor). I think that would be a better experience since it would let the cursor move smoothly the same as if it were using relative movement. That was a much larger change though and would require an update to the config schema so I avoided it for now

@AsocPro
Copy link

AsocPro commented Feb 25, 2025

@rygwdn Thanks for this. I'm currently running this change in my own build and having 3 displays on my Mac with the middle one being ~300px taller than the other two made it very annoying switching back and forth at the top and bottom edge of the display but this makes it completely seamless! It even works better than the stock macos alignment with a mouse connected directly to the Mac!

@hrvach hrvach merged commit 6ef3d7b into hrvach:main Mar 9, 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.

4 participants