sindresorhus/get-windows

Trigger an event when focus changes

Open

#1 opened on Apr 4, 2016

View on GitHub
 (5 comments) (14 reactions) (0 assignees)JavaScript (194 forks)user submission
enhancementhelp wanted

Repository metrics

Stars
 (913 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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 😀

Contributor guide