Hammerspoon / hammerspoon

Staggeringly powerful macOS desktop automation with Lua
http://www.hammerspoon.org
MIT License
12.07k stars 583 forks source link

Windows are still animating with hs.window.animationDuration=0 #3297

Open fny opened 2 years ago

fny commented 2 years ago

I'm trying to migrate from using Rectangle App (https://github.com/rxhanson/Rectangle) for window resizing. The resizes there are instantaneous. With Hammerspoon, I'm seeing some amount of animation even when the duration is set to zero. How can I fix this?

Rhys-T commented 2 years ago

Are you using Grammarly, 1Password, or anything else that would be using the Accessibility API to watch other apps? Some of these set a flag that's needed to get Chrome and some other apps to build the full tree of accessibility info. Unfortunately, that flag has some side effects, including causing the system to do its own animations for any resizing/moving that Hammerspoon does. I've posted more details on https://github.com/Hammerspoon/hammerspoon/issues/3224#issuecomment-1294359070, including a workaround based on the one Rectangle uses.

To determine if the flag is set, run this code in the Hammerspoon console:

for _, app in ipairs(hs.application.runningApplications()) do
    local axApp = hs.axuielement.applicationElement(app)
    if axApp.AXEnhancedUserInterface then
        return "yes"
    end
end
return "no"