kasper / phoenix

A lightweight macOS window and app manager scriptable with JavaScript
https://kasper.github.io/phoenix/
Other
4.36k stars 128 forks source link

Disable AXEnhancedUserInterface temporarily while moving or resizing windows #310

Closed Kauhsa closed 1 year ago

Kauhsa commented 2 years ago

Should fix #301.

There is an issue with some applications not wanting to respect moving or resizing properly. Most notably, this affects Google Chrome. There is a long discussion about a similar issue with Rectangle here: https://github.com/rxhanson/Rectangle/issues/165

And their current approach to fix the issue is here (which I followed loosely): https://github.com/rxhanson/Rectangle/blob/95019b71e8dde1ff7e52f660788fe4f44e3fab14/Rectangle/AccessibilityElement.swift#L146

This was my first time writing Objective C, so be gentle. Tested in macOS 12.2.1.

PS. hi Kasper, maybe you remember me! This is a very useful app for trying to get a more keyboard-oriented workflow going on macOS after being used to everything convenient in i3 :-)

kasper commented 1 year ago

Hi @Kauhsa, of course I remember you! 👋 I hope everything is good! Thanks for looking into this and sorry for the long time for a response. I will need to investigate this a bit as well.

Kauhsa commented 1 year ago

Alright! This still seems to be an issue with recent MacOS (and ARM laptops) - at least latest Phoenix release still seems to struggle with latest Chrome for me.

kasper commented 1 year ago

Would you be able to share some small repro function that doesn’t work for you with Chrome?

Kauhsa commented 1 year ago

Well well, you raise a good point! I was somewhat hasty with my recent attempt to reproduce it. What I thought to be "still broken" was actually just me having a new laptop with a smaller screen (and resolution) than before, which caused unrelated issues due to logic in my personal config.

So, looks like the current release indeed works with chrome! Maybe something changed on Chrome - there are such reports on Rectangle: https://github.com/rxhanson/Rectangle/issues/912#issuecomment-1339573026. Or maybe I was just sloppy in the first place - I'd like to say that I did compare master and my branch to ensure it fixed the issue, but that will forever remain a mystery 😉

I don't remember encountering the issue in other programs than Chrome, so I can't check whether anything else has any issues without this change, unfortunately. But I quickly didn't find any such programs. So, I think closing this without merging is appropriate.

(FWIW, the issue was - as far as I can remember - Chrome doing odd animations and ending up in incorrect position when trying to use .setFrame() on Chrome window. Original issue was a bit light in this regard, but the linked Rectangle issue described similar behaviour.)

kasper commented 1 year ago

Great to hear! Thanks for confirming, I also couldn’t replicate this with the latest Chrome. Don’t worry, this is not the first time Chrome would have broken something in between versions. 😁