sindresorhus/get-windows

Trigger an event when focus changes

Open

#1 创建于 2016年4月4日

在 GitHub 查看
 (5 评论) (14 反应) (0 负责人)JavaScript (913 star) (194 fork)user submission
enhancementhelp wanted

描述

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 😀

贡献者指南