Skip to content

Instantly share code, notes, and snippets.

@SethMilliken
Created January 12, 2024 04:36
Show Gist options
  • Save SethMilliken/3cc3255c1ff45965839ade7b803f9ad8 to your computer and use it in GitHub Desktop.
Save SethMilliken/3cc3255c1ff45965839ade7b803f9ad8 to your computer and use it in GitHub Desktop.
Hammerspoon AXEnhancedUserInterface issue workaround
function windowMoveFunction(window, screen, rect)
hotfix = axHotfix(window)
window = hotfix:window()
window:moveToScreen(screen)
window:moveToUnit(rect)
hotfix:revert()
end
-- cf. https://github.com/Hammerspoon/hammerspoon/issues/3224
function axHotfix(win)
if not win then win = hs.window.frontmostWindow() end
local axApp = hs.axuielement.applicationElement(win:application())
local wasEnhanced = axApp.AXEnhancedUserInterface
if wasEnhanced then
print("AXEnhancedUserInterface was true for window: forced false")
axApp.AXEnhancedUserInterface = false
end
hotfix = {}
function hotfix:window ()
return win
end
function hotfix:revert ()
axApp.AXEnhancedUserInterface = wasEnhanced
print(string.format("AXEnhancedUserInterface for window: %s", wasEnhanced))
end
return hotfix
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment