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

Trigger an event when focus changes #1

Open
sindresorhus opened this issue Apr 4, 2016 · 5 comments
Open

Trigger an event when focus changes #1

sindresorhus opened this issue Apr 4, 2016 · 5 comments

Comments

@sindresorhus
Copy link
Owner

I imagine it would be something like:

const activeWin  = require('active-win');

activeWin.on('change', win => {
    console.log(win.title);
});

With win being the same as activeWin() 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 😀

@bencevans
Copy link

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

@bencevans
Copy link

@Pandakls

This comment has been minimized.

@sindresorhus

This comment has been minimized.

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

No branches or pull requests

3 participants