Rectangle icon indicating copy to clipboard operation
Rectangle copied to clipboard

Snapping randomly not working

Open dstoyanoff opened this issue 1 year ago • 36 comments

  • [x] This is a new bug that hasn't been documented in a closed issue or in the Readme.

macOS version: Sonoma Rectangle version: 0.72 (78) Logs if applicable (In Rectangle menu, hold option, "View Logging..."): no logs

I saw that you released a version yesterday that was supposed to fix snapping, but I am still having issues with it and it only works from time to time. Can't isolate when it stops working

dstoyanoff avatar Sep 25 '23 13:09 dstoyanoff

This happening to me too.

alexkev avatar Sep 25 '23 15:09 alexkev

Thanks for letting me know. The adjustments made to snapping stem from a macOS bug, and now what Rectangle is doing is grabbing all of the windows on screen and finding the one under the cursor, as opposed to getting the accessibility API to tell it which element/window is under the cursor. Since you don't see any logs, this means that Rectangle is finding a window under the cursor, although it might be possible that you have an app that is placing a transparent window over the entire display, and that's what Rectangle could now be finding. Do you have an app that might be doing something like that?

rxhanson avatar Sep 25 '23 15:09 rxhanson

I have the same problem after the last update, it only works shortly after a restart and then no longer works

MacOS: Sonoma 14.0 Rectangle Pro version: 3.0.11 (152)

Danny-mtb avatar Sep 25 '23 17:09 Danny-mtb

@rxhanson, the thing is that it is random and not associated to a particular app. Happens with basic apps like the mail client. Then all of a sudden it starts working without even me restarting the app. I'll keep trying to understand what happens and let you know if I discover something more.

Btw, seeing logging while it works, I can see some debug logs around positioning and coordinates. While not working, not of this was getting printed.

dstoyanoff avatar Sep 26 '23 04:09 dstoyanoff

Interesting thing is for me restarting the app doesn't fix the issue. I have left the logging ongoing until the issue occur, here is the result:

2023-09-26T10:45:54+03:00: Unable to obtain the accessibility element with the specified attribute at mouse location
2023-09-26T10:45:54+03:00: Unable to obtain the accessibility element with the specified attribute at mouse location
2023-09-26T10:45:56+03:00: Window under cursor fallback matched: Safari
2023-09-26T10:45:56+03:00: Window under cursor fallback matched: Safari
2023-09-26T10:45:56+03:00: Failed to find frontmost window.
2023-09-26T10:45:58+03:00: Unable to obtain window info from location
2023-09-26T10:45:58+03:00: Window under cursor fallback matched: Google Chrome
2023-09-26T10:45:59+03:00: AX sizing proposed: (1706.6666666666667, 1360.0), result: (1707.0, 1360.0)
2023-09-26T10:45:59+03:00: AX position proposed: (1706.0, 25.0), result: (1706.0, 25.0)
2023-09-26T10:45:59+03:00: AX sizing proposed: (1706.6666666666667, 1360.0), result: (1707.0, 1360.0)
2023-09-26T10:45:59+03:00: centerThird | display: (0.0, 55.0, 5120.0, 1360.0), calculatedRect: (1706.0, 25.0, 1706.6666666666667, 1360.0), resultRect: (1706.0, 25.0, 1707.0, 1360.0), srcScreen: C49RG9x, destScreen: C49RG9x, resultScreen: C49RG9x
2023-09-26T10:48:52+03:00: Unable to obtain window info from location
2023-09-26T10:48:52+03:00: Unable to obtain the accessibility element with the specified attribute at mouse location
2023-09-26T10:49:39+03:00: Unable to obtain window info from location
2023-09-26T10:49:39+03:00: Unable to obtain the accessibility element with the specified attribute at mouse location
2023-09-26T10:49:39+03:00: Unable to obtain window info from location
2023-09-26T10:49:39+03:00: Unable to obtain the accessibility element with the specified attribute at mouse location
2023-09-26T10:55:31+03:00: Unable to obtain the accessibility element with the specified attribute at mouse location
2023-09-26T10:55:31+03:00: Unable to obtain the accessibility element with the specified attribute at mouse location
2023-09-26T10:55:34+03:00: Window under cursor fallback matched: Slack
2023-09-26T11:08:30+03:00: Unable to obtain the accessibility element with the specified attribute at mouse location

I don't really see anything different to be honest.

Unable to obtain the accessibility element with the specified attribute at mouse location is shown on mouse click on the menu bar (maybe in some other cases too)

Rest of the errors are also observed before and after snapping stopped working, so it is either not related or the error is the same in multiple occasions

dstoyanoff avatar Sep 26 '23 08:09 dstoyanoff

I've been able to actually isolate one of the occasions of the issue and it is with notifications. I use reminders a lot and while there is a visible reminder, snapping doesn't work. Closing the reminder fixes it.

Will monitor for other causes as I think this is not the only one.

dstoyanoff avatar Sep 26 '23 08:09 dstoyanoff

@dstoyanoff Would you mind using this build? (you'll have to bypass gatekeeper to install it since the auto-builds aren't signed. There's no harm in using it, or you can wait until I create a release)

https://github.com/rxhanson/Rectangle/actions/runs/6312463594

That build will ignore Notification Center and has an additional log statement that will tell us which window is being found under the cursor.

rxhanson avatar Sep 26 '23 12:09 rxhanson

Unfortunately it didn't work. Here is the log:

2023-09-26T15:36:07+03:00: Window found at (4323.9140625, 53.328125): WindowInfo(id: 20, level: 23, frame: (0.0, 0.0, 5120.0, 1440.0), pid: 822, processName: Optional("Notification Centre"))

dstoyanoff avatar Sep 26 '23 12:09 dstoyanoff

Seems it should be Notification Centre, while you ignored Notification Center

dstoyanoff avatar Sep 26 '23 12:09 dstoyanoff

Thanks for the quick test! Here's another one, where rather than keying off process name (obviously fragile), I'm lowering the acceptable window level below that of Notification Center.

https://github.com/rxhanson/Rectangle/actions/runs/6313160287

rxhanson avatar Sep 26 '23 13:09 rxhanson

Thank you for the fast delivery. This build seems to be working. I will be monitoring if it stops working in some other occasion. Thanks for the quick reaction!

dstoyanoff avatar Sep 26 '23 13:09 dstoyanoff

In my case, snapping doesn't work for my secondary monitor (of a smaller size than the primary one). All operations would happen at the primary one instead. It just randomly started these last few days and I have not updated Rectangle or Mac explicitly.

Zackhardtoname avatar Sep 28 '23 02:09 Zackhardtoname

@Zackhardtoname, which version of Rectangle are you using?

rxhanson avatar Sep 28 '23 02:09 rxhanson

@Zackhardtoname, which version of Rectangle are you using?

About that... I thought an update might fix it so I just updated Rectangle to the latest without noting the version...

Zackhardtoname avatar Sep 28 '23 02:09 Zackhardtoname

@Zackhardtoname I went ahead and released the version discussed in this issue as v0.73, so you can try that one and see if it fixes the issue you're having.

rxhanson avatar Sep 28 '23 02:09 rxhanson

I just updated it again and it didn't work. Mac OS version is 13.5 btw.

Zackhardtoname avatar Sep 28 '23 02:09 Zackhardtoname

After both the update and reconnecting the cables, mine started working smoothly again, without any machine restarts. Reconnecting cables before the update didn't work

Zackhardtoname avatar Oct 01 '23 01:10 Zackhardtoname

@Zackhardtoname interesting, thanks for following up. I suspect this would be an issue in what macOS is communicating to Rectangle, and might not be something fixable from within Rectangle. Let me know if you hit the issue again - maybe there's something more we can figure out.

rxhanson avatar Oct 01 '23 01:10 rxhanson

This is happening to me too. I usually use my MacBook Air with a thunderbolt dock and second monitor. If I try to snap a window that is already on the second monitor, then it's 50/50 whether snapping works. But if I drag and drop the window to my laptop screen, then move it back to the second monitor it seems to snap every time.

Version: 0.73 macOS Sonoma 14.1 Log is empty when snapping fails.

XadRav avatar Oct 30 '23 16:10 XadRav

Same for me, tried to reinstall. Version: 0.74 (80) macOS Sonoma 14.1 Log is empty when snapping fails too

vani2 avatar Nov 02 '23 20:11 vani2

Yep just updated to version 0.74 and same thing is happening.

XadRav avatar Nov 02 '23 20:11 XadRav

If you’ve recently updated macOS, you’ll want to reboot your Mac one more time.

rxhanson avatar Nov 02 '23 23:11 rxhanson

First of all, absolutely love this app, thank you for your work! I honestly don't know if i can even use a mac in my workflow without this...

This issue have just started to happen to me too, also randomly.

I'm using:

Sonoma 14.1.1 Rectangle 0.74 (80)

orginally i thought it was because i was using an old OS Vnetura, so i updated today but it did not fix the issue.

Thanks for your help.

touvex avatar Nov 16 '23 21:11 touvex

@touvex, do you see any logs for this? You can hold the option key in the menu bar menu and select view logging, then try to reproduce the issue.

rxhanson avatar Nov 17 '23 05:11 rxhanson

@touvex, do you see any logs for this? You can hold the option key in the menu bar menu and select view logging, then try to reproduce the issue.

Thank you, I think somehow, it has fixed itself, fingers crossed, maybe i just needed that restart after updating OS.

I think it may have been Microsoft Teams NEW, i switched back to Teams Classic and it has not had issues since, i will keep monitoring and post here if that changes! Thanks again, your app is amazing!

touvex avatar Nov 22 '23 14:11 touvex

PS. i actually didnt know you had pro, as i went to donate, so have now bought the pro, do you advise i uninstall normal first and then install pro?

touvex avatar Nov 22 '23 14:11 touvex

Can confirm that Microsoft Teams NEW has definetly an impact. Though it seems to be inconsistent across colleagues. Problems started popping up once they installed the "NEW" version of teams, but not for all of them. I guess this is not a rectangle problem then but rather Teams doing suspicious things .... :/

tibeer avatar Jan 10 '24 08:01 tibeer

@touvex Thanks for purchasing pro! Sorry I never responded, but for future reference I just recommend not having them running at the same time.

@tibeer, thanks for reporting this. There have been some adjustments to Rectangle in recent releases, and you can try this terminal command to revert to an old way of how Rectangle would obtain the window under the cursor: defaults write com.knollsoft.Rectangle systemWideMouseDown -int 1

In short, the old way can break click event receiving for certain apps for some users, but the new way can make it so snapping doesn't work for some apps for certain users. At least in the new way, it's not as frustrating for the small percentage of users that run into an issue. It appears that most users are fine with either way is used.

rxhanson avatar Jan 11 '24 04:01 rxhanson

Perfect! Will try it out once myself or colleagues run into this. By the way I forgot to mention that keyboard shortcuts work all the time, so it might be pretty much the mouse thing :) (and if you close the teams NEW app, everything is back to normal)

tibeer avatar Jan 11 '24 04:01 tibeer

Hey there. Here is my solution what works for me: You must pick the window very left near the corner and move it where you want like before. You can't pick everywhere you want like before. But this is a solution for me that help me during my daily business. It's a little kind of spooky, but it is a workaround :)

ra-beer avatar Jan 19 '24 06:01 ra-beer