Open sindresorhus opened 8 years ago
Not ideal but I ended up polling and emitting an event if the data changed from the previously cached data... https://github.com/bencevans/active-app-watcher#readme
Python implementation https://stackoverflow.com/questions/23786289/how-to-correctly-detect-application-name-when-changing-focus-event-occurs-with for linux using xlib
Some more resources:
That kind of event emitter would be awesome.
@Pandakls Your comment doesn't add anything to the conversation. In the future, please use GitHub reactions instead.
I imagine it would be something like:
With
win
being the same asactiveWin()
returns.No idea how to achieve this though as it would have to communicate with the binary somehow. Maybe spawn the native binary when someone subscribes to the events, and have the binary push to stdout for each event.
PR welcome 😀