Skip to content
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

hs.window.filter stops emitting windowFocused events for application if one window has tabs #3626

Open
mogenson opened this issue Apr 8, 2024 · 1 comment

Comments

@mogenson
Copy link

mogenson commented Apr 8, 2024

The default hs.window.filter will emit "windowFocused" events for different windows within the same application. Except if one of the windows has multiple tabs. Then, no "windowFocused" events will be emitted for any window within the application, even non-tabbed windows. Closing the window with tabs will restore the window filter behavior.

For example:

  1. Subscribe to window events for the default filter:
hs.window.filter.default:subscribe({hs.window.filter.windowFocused}, function(window, app, event) print(window, event) end)
  1. Open Finder window 1 and Finder window 2.
  2. Switch back and forth and observe that window filter "windowFocused" events are emitted.
  3. Open a tab in Finder window 2.
  4. Switch back and forth between Finder window 1 and 2 and tabs in Finder window 2. No "windowFocused" events are printed.
  5. Switch from Finder to another app, like the HammerSpoon Console. A "windowFocused" event is printed.
  6. Close the tab in Finder window 2. Now "windowFocused" events are again printed for each window switch.

Other window filter events, such as "windowResized", work with tabbed windows.

@dmgerman
Copy link

dmgerman commented Apr 20, 2024

I confirm this happens, but I think it seems that the behaviour is related to the creation of the new window if the previous one has tabs. Behaviour is ok if Finder has windows, then another one is created, and tab is added.

Try

hs.window.filter.setLogLevel('verbose')

and see what is going on. The source code for window_filter can be easily edited and reloaded. it is in Hammerspoon.app/Contents/Resources/extensions/hs/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants