Open K4tsuki opened 2 years ago
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:
will be executed and will early return without making new application watcher.
Looking at the source code, it looks like the name of the app is used as a key to many tables in the hs.window.filter data structures and a rewrite might be needed to fix these issues.
So if you have another app running with the same name, then hammerspoon does not consider them to be different apps.
I think the easiest way to work around this problem is to create a copy of the app and renaming the app (changing the name of the app in the InfoPlist.strings in the bundle) to a unique name.
Test code:
Then launch
IINA
or other applications from dock, then run commandopen -n -a "/Applications/IINA.app"
The
windowFocused
handler is executed for both windows, but thewindowMoved
handler isn't executed for window opened byopen -n -a
command.Other note: I think
hs.window.allWindows()
return the expected window id.