active-window icon indicating copy to clipboard operation
active-window copied to clipboard

how to get activeWindow one more times

Open hnlinzhi19 opened this issue 7 years ago • 1 comments

I have a problem, I want to get now active window when i press some keys。so first i press key ,I can get the active window,but second press back throw stderr.toString(); this is my code : `'use strict'; const ioHook = require('iohook'); const monitor = require('active-window');

ioHook.on("keydown", event => { console.log(event); /* You get object like this { type: 'mousemove', x: 700, y: 400 } */ if (event.keycode === 67 && event.rawcode === 120) { monitor.getActiveWindow(() => { try { console.log("App: " + window.app); console.log("Title: " + window.title); }catch(err) { console.log(err); } }); } });

//Register and start hook ioHook.start();

`

the errors : throw stderr.toString();

hnlinzhi19 avatar Mar 10 '18 02:03 hnlinzhi19

I have this problem as well and now I've changed to active-win, it can also give me the window without using a callback.

zhaolewen avatar Sep 11 '18 14:09 zhaolewen