rxhanson / Rectangle

Move and resize windows on macOS with keyboard shortcuts and snap areas
https://rectangleapp.com
Other
25.1k stars 742 forks source link

Snapping randomly not working #1270

Open dstoyanoff opened 9 months ago

dstoyanoff commented 9 months ago

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

alexkev commented 9 months ago

This happening to me too.

rxhanson commented 9 months ago

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?

Danny-mtb commented 9 months ago

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)

dstoyanoff commented 9 months ago

@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 commented 9 months ago

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 commented 9 months ago

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.

rxhanson commented 9 months ago

@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.

dstoyanoff commented 9 months ago

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 commented 9 months ago

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

rxhanson commented 9 months ago

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

dstoyanoff commented 9 months ago

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!

Zackhardtoname commented 9 months ago

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.

rxhanson commented 9 months ago

@Zackhardtoname, which version of Rectangle are you using?

Zackhardtoname commented 9 months ago

@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...

rxhanson commented 9 months ago

@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.

Zackhardtoname commented 9 months ago

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

Zackhardtoname commented 9 months ago

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

rxhanson commented 9 months ago

@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.

XadRav commented 8 months ago

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.

vani2 commented 8 months ago

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

XadRav commented 8 months ago

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

rxhanson commented 8 months ago

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

touvex commented 7 months ago

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.

rxhanson commented 7 months ago

@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.

touvex commented 7 months ago

@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 commented 7 months ago

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?

tibeer commented 5 months ago

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 .... :/

rxhanson commented 5 months ago

@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.

tibeer commented 5 months ago

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)

ra-beer commented 5 months ago

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 :)

XadRav commented 4 months ago

@rxhanson Just to add another data point, I have confirmed that it is "New" Teams causing this issue for me as well. This is very repeatable with the bug consistently happening while New Teams is running, and goes away when I quit New Teams or while running Old Teams. The terminal command you posted also seems to fix the issue with new Teams running. Would it be possible in future releases to perhaps add an option for that command in preferences so I won't need to find this post to find the command in the future? Thanks for all your hard work!

rxhanson commented 4 months ago

@XadRav, I don't have plans to add this into the UI, mainly because it would be really hard to convey concisely enough to add it in. However, if I add a "hidden settings" sort of UI at some point, then I'll put it there.

Victorious3 commented 3 months ago

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 .... :/

I have the same issue and I can confirm that it goes away when quitting teams. Very strange.

HackettLai commented 1 week ago

I'm having the same issue on the latest version as well. It seems to happen only on my secondary monitor. I tried to snap Finder to the edge, but nothing happened. Here is my screenshot of the log for investigation. CleanShot 2024-06-24 at 16 45 11

The last successful attempt was on the built-in display.

rxhanson commented 1 week ago

@HackettLai Are the initial logs the ones where it's not working, where it's unable to obtain the accessibility element? It is not common for this to happen on Finder, do you see this with all apps, and is there anything unusual about your setup?

HackettLai commented 1 week ago

@HackettLai Are the initial logs the ones where it's not working, where it's unable to obtain the accessibility element? It is not common for this to happen on Finder, do you see this with all apps, and is there anything unusual about your setup?

Hi @rxhanson I've played around with it for a day and even reinstalled macOS. It seems like I can now provide a more detailed description of the issue. I've recorded a video for better investigation: YouTube Link

Symptom

  1. While recording the video, it seems like the issue happens on my built-in display.
  2. I can snap to position on both sides of my display, but the snap area cannot be recognized on the built-in display.
  3. Sometimes it can be recognized once but fails on the recognition again afterward.
  4. I've tried both Finder and Notion (at 1:17), and both applications produce the same result.
  5. When the issue happens, most of the time nothing gets logged in the logging window. However, I occasionally receive the message: "Unable to obtain the accessibility element with the specified attribute at mouse location." CleanShot 2024-06-26 at 10 20 20

App Setting CleanShot 2024-06-26 at 10 01 04CleanShot 2024-06-26 at 10 01 04 CleanShot 2024-06-26 at 10 01 07CleanShot 2024-06-26 at 10 01 07

Information