-
Notifications
You must be signed in to change notification settings - Fork 595
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
Significant delay when loading hs.window.filter #3712
Comments
Thanks for that; it speeds up starting EnhancedSpaces (https://github.com/franzbu/EnhancedSpaces.spoon) and I haven't encountered any side effects. |
I can confirm I have the same issue and the above mentioned method works |
Yes, it feels like it reduces the loading time significantly. |
I did a bit of code reading. This issue with window filter is that it keeps track of the name of applications that are "problematic". Kind == 0 but will have never create windows. The problem with the code is that it uses the app name instead of the bundleID. The issue appears to be that instances of com.apple.WebKit.WebContent operate under many different names. In practice, what needs to be blacklisted is the bundle ID, not the name. Essentially, as long as window.filter tracks the app name, this is a game of whack-a-mole. To help maintain this list, the original author wrote: hs.window.filter._showCandidates() you can run this function to see which app names are creating problems. I think we need to add the ability to blacklist bundleIDs. This will need an equivalent to windowfilter.isGuiApp(appname) that uses bundleID instead of appname. |
I worked on this today and I have a solution and some comments.
In the meantime: if you have two instances of the same app, expect delays in the reload; if you use webkit apps, add the if condition in the issue description. |
It seems that hammerspoon's window filter module calls |
Here is the code I am working on: https://github.com/dmgerman/hammerspoon/tree/window-filter Please try it, and if it works, i'll submit the PR. |
Works perfectly |
@dmgerman It seems that your code has a bug. You should replace |
Thanks. I'll fix that. Regarding the setAppFilter: I don't like functions that ambiguously do two different things. So I prefer to keep one for app Name and one for app BundleID. Is there any advantage aside convinience |
Different applications may share the same names, but almost never share the same bundle identifiers. Providing two APIs is better, but I think the important thing is that you provide the one for bundle identifiers. |
i have pushed the fix
I was looking at the code and refactoring it to have bundleID and app separately seems like a pain that might create unexpected bugs. What do you think of the following: if the application name has at least one period: then consider it a bundle id, otherwise it is an appname. We'll just make sure that any time a filter is created, we do this test. |
@dmgerman |
I spent a bit more time on this today. I think I am going to drop the idea of keeping bundleIDs and application name separated. Trying to keep different logics is making the code more complicated than it is already. I also wrote a function to make sure that pids that no longer exist are released, so that should hopefully take care of the memory leaks. |
I experienced significant delay when loading hammerspoon scripts. The delay happens when hammerspoon loads
hs.window.filter
module for the first time. The delay lasts for almost the same time ashs.window._timed_allWindows
hangs. Considering that process "com.apple.WebKit.WebContent" accounts for major part of delay when executinghs.window._timed_allWindows
, I add a line of code in function "startAppWatcher" in file "window_filter.lua". It seems that the unexpected delay disappears.I don't know whether this is a bug, but it does occur to both of my MBP. Have anyone else come into it?
The text was updated successfully, but these errors were encountered: