2017-01-31 07:50:28 +01:00
|
|
|
const Launcher = require('../../comp/launcher');
|
2016-04-19 20:48:49 +02:00
|
|
|
|
2019-08-16 23:05:39 +02:00
|
|
|
const AutoTypeHelper = function() {};
|
2016-04-19 20:48:49 +02:00
|
|
|
|
2019-09-12 22:38:21 +02:00
|
|
|
AutoTypeHelper.prototype.getActiveWindowInfo = function(callback) {
|
2016-04-24 22:29:28 +02:00
|
|
|
Launcher.spawn({
|
|
|
|
cmd: 'xdotool',
|
2019-09-12 22:38:21 +02:00
|
|
|
args: ['getactivewindow', 'getwindowname', 'getactivewindow'],
|
|
|
|
complete(err, out) {
|
|
|
|
let windowInfo;
|
|
|
|
if (out) {
|
|
|
|
const [id, title] = out.trim().split('\n');
|
|
|
|
windowInfo = {
|
|
|
|
id,
|
|
|
|
title
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return callback(err, windowInfo);
|
2016-04-24 22:29:28 +02:00
|
|
|
}
|
|
|
|
});
|
2016-04-19 20:48:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = AutoTypeHelper;
|