You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Window filters in my scripts do not subscribe to any window events when hammerspoon loads, which means WF:isWindowAllowed may be called before startAppWatcher (called by WF:subscribe & WF:getWindows). Thus in WF:isWindowAllowed, the global.activate is set as a table filled with necessary data only for WF:isWindowAllowed, which is invalid for startAppWatcher where global.activate is assumed to be an instance of App with a deactivated method. It leads to error when calling WF:subscribe or WF:getWindows (thus calling startApplWatcher) after calling WF:isWindowAllowed
The bug can be fixed by adding a check in App:getAppWindows:
-- events aren't "inserted" across apps (param name notwithstanding) so an active app should NOT :deactivate-- another app, otherwise the latter's :unfocused will have a broken "inserted" chain with nothing to close itfunctionApp:getAppWindows()
self:getCurrentSpaceAppWindows()
self:getFocused()
ifself.app:isFrontmost() thenlog.df('app %s is the frontmost app',self.name)
-ifglobal.activethenglobal.active:deactivated() end--see comment above+ifglobal.activeandglobal.active.deactivatedthenglobal.active:deactivated() end--see comment aboveglobal.active=selfifself.focusedthenself.focused:focused(true)
log.df('window %d is the focused window',self.focused.id)
endendend
I have not experienced bugs since. But maybe we should add a similar check in App:activated too.