2016-07-24 09:53:34 +02:00
|
|
|
const Launcher = require('../../comp/launcher');
|
|
|
|
const AutoTypeNativeHelper = require('./auto-type-native-helper');
|
2016-04-19 20:03:02 +02:00
|
|
|
|
2019-08-16 23:05:39 +02:00
|
|
|
const AutoTypeHelper = function() {};
|
2016-04-19 20:03:02 +02:00
|
|
|
|
2019-09-12 22:38:21 +02:00
|
|
|
AutoTypeHelper.prototype.getActiveWindowInfo = function(callback) {
|
2016-04-24 14:08:46 +02:00
|
|
|
Launcher.spawn({
|
2016-07-24 09:53:34 +02:00
|
|
|
cmd: AutoTypeNativeHelper.getHelperPath(),
|
2016-04-24 14:08:46 +02:00
|
|
|
args: ['--window-info'],
|
2019-08-18 10:17:09 +02:00
|
|
|
complete(err, out) {
|
2019-08-16 23:05:39 +02:00
|
|
|
if (err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
2019-09-12 22:38:21 +02:00
|
|
|
const [id, title, url] = out.trim().split('\n');
|
|
|
|
const windowInfo = {
|
|
|
|
id,
|
|
|
|
title,
|
|
|
|
url
|
|
|
|
};
|
|
|
|
return callback(null, windowInfo);
|
2016-04-24 14:08:46 +02:00
|
|
|
}
|
|
|
|
});
|
2016-04-19 20:03:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = AutoTypeHelper;
|