`hs.window.filter.new(true)` return two windows with same `id` and doesn't catch some events, if the window has been opened by command `open -n -a someapp`
K4tsuki opened this issue · comments
Test code:
filter = hs.window.filter.new(true)
filter:subscribe({
[winfilter.windowMoved] = function(win, appname, eventname)
print('moved')
print("win => ", win:id())
print("title => ", win:title())
end,
[winfilter.windowFocused] = function(win, appname, eventname)
print("focused")
print("win => ", win:id())
print("title => ", win:title())
end
Then launch IINA
or other applications from dock, then run command open -n -a "/Applications/IINA.app"
The windowFocused
handler is executed for both windows, but the windowMoved
handler isn't executed for window opened by open -n -a
command.
Other note: I think hs.window.allWindows()
return the expected window id.
I'm also noticing that hs.window.switcher
doesn't see windows created from open -n -a someapp
. Is that the same bug or a different bug?
In hs.window.switcher
example, it uses hs.window.filter
, so I think it is affected.
If I am not wrong, the hs.window.filter
problem is because of it catch all running application based on appname
. If the command open -n -a
is invoked then this line:
hammerspoon/extensions/window/window_filter.lua
Line 1412 in 7f34baa
will be executed and will early return without making new application watcher.