-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
windowfilter.focusWindow* methods hang for ~10s #3574
Comments
If you open the Hammerspoon console and run:
you'll almost certainly see that one application is taking multiple seconds to respond. Either one of your apps added a new helper which doesn't implement accessibility APIs, or one of your apps has gotten internally stuck and has stopped responding to accessibility calls. The latter is a thing that happens from time to time and either restarting that app, or rebooting, clear it up. |
Ah, interesting! Thanks for the tip. This is what I see when I run it a couple times in a row, and then again many hours later:
I don't use Safari, so I'm guessing I tried rebooting yesterday, and that fixed it for a few minutes but then it started hanging again. I'll try again now. |
Turns out rebooting doesn't fix it after all. I've tried twice now, and it still happens immediately on startup. I may have misremembered it working for a few minutes the first time I tried. Any other debugging ideas? |
Huh, that's really odd, we're supposed to ignore WebContent because it's known to respond slowly: https://github.com/Hammerspoon/hammerspoon/blob/master/extensions/window/window.lua#L85 |
As another data point, I rebooted yesterday evening, and that did indeed fix the problem again...for a while, like before. It was back when I opened the computer again this morning though. I didn't start any new apps between it working and breaking, but the computer did sleep overnight. Maybe that's related? |
I'm not sure whether this is relevant or not, but looking at that code, it looks like |
Hmm! If it helps, I tried |
FWIW I have been using Hammerspoon for ~5 years and have never been able to get window functionality to work consistently without lag, even having added a bunch of items to What I have ended up doing, which has worked well, is building a thin Lua API on top of yabai. You can then just call yabai, which is super-fast, from HS. Example for anyone interested in a similar approach-- credit to @asmagill and @cmsj for helping out with the
|
I have the same delay with Webkit - and the same problem with a delay in:
> hs.window._timed_allWindows()
2024-08-15 19:33:09: took 0.06s for 2BUA8C4S2C.com.agilebits.onepassword4-helper
2024-08-15 19:33:09: took 0.05s for com.apple.dock
2024-08-15 19:33:09: took 0.12s for com.apple.appkit.xpc.openAndSavePanelService
2024-08-15 19:33:09: took 0.05s for mo.com.sleeplessmind.Wooshy
2024-08-15 19:33:09: took 0.07s for com.apple.HeadphoneSettings
2024-08-15 19:33:09: took 0.09s for com.apple.Family-Settings.extension
2024-08-15 19:33:09: took 0.09s for com.agilebits.onepassword4
2024-08-15 19:33:09: took 0.14s for org.pqrs.Karabiner-Elements.Settings
2024-08-15 19:33:09: took 0.08s for com.apple.wifi.WiFiAgent
2024-08-15 19:33:09: took 0.09s for com.apple.systempreferences.AppleIDSettings
2024-08-15 19:33:09: took 0.07s for N/A
2024-08-15 19:33:09: took 0.06s for com.apple.PressAndHold
2024-08-15 19:33:09: took 0.07s for com.apple.FollowUpSettings.FollowUpSettingsExtension
2024-08-15 19:33:09: took 0.06s for com.apple.NetworkExtensionSettingsUI.NESettingsUIExtension
2024-08-15 19:33:09: took 33.15s for com.apple.WebKit.WebContent
table: 0x60000268a800
> hs.window._timed_allWindows()
2024-08-15 19:35:06: took 24.03s for com.apple.WebKit.WebContent
table: 0x6000026f4240
> hs.window._timed_allWindows()
2024-08-15 19:38:38: took 24.04s for com.apple.WebKit.WebContent
table: 0x6000026cd480
```lua |
Hi! First off, thank you all for building and maintaining Hammerspon. It's great! I couldn't live without it.
I've been happily using v0.9.100 with the same unchanged config for a while now. Sometime in the past few days, the windowfilter
focusWindow*
methods started hanging for 5-10s every time they're called. I'm not sure what suddenly triggered this, but my best guess is that I upgraded to macOS 14.1.2 (23B92) from 14.1.1.Specifically, this in the console reproduces the hang for me most times I run it and there's a window to the east:
Doesn't seem to be CPU or memory, Hammerspoon's memory footprint is only 20-30MB when this happens, and it's not busy-waiting, it's at <1% CPU usage throughout the hang. I assume it's waiting on I/O from something, but I don't know what. Are there any known issues with macOS 14.1.2? Could any window configuration or apps I have open cause this?
Thank you in advance!
The text was updated successfully, but these errors were encountered: