#29 is replacing the logic for retrieving windowtitle and active app from macOS clients.
There seems to be lots of options on how to do this, and we should definitely replace the applescript.
I just want to share a bit of what I found out.
The nicest way for us to do this is probably through python and AppKit.
I can easily get the active application by:
from AppKit import NSWorkspace
workspace = NSWorkspace.sharedWorkspace()
app_name = workspace.frontmostApplication().localizedName()
This gist tries to do what we want.
However, it does not work all the time for me, since window['kCGWindowOwnerName'] == 'iTerm', while app.localizedName() == 'iTerm2'. Also, it seems that the gist is just returning the first match. Maybe windowList is always sorted in the correct order, not sure.
#29 is replacing the logic for retrieving windowtitle and active app from macOS clients.
There seems to be lots of options on how to do this, and we should definitely replace the applescript.
I just want to share a bit of what I found out.
The nicest way for us to do this is probably through python and
AppKit.I can easily get the active application by:
This gist tries to do what we want.
However, it does not work all the time for me, since
window['kCGWindowOwnerName'] == 'iTerm', whileapp.localizedName() == 'iTerm2'. Also, it seems that the gist is just returning the first match. Maybe windowList is always sorted in the correct order, not sure.