2019-09-15 14:16:32 +02:00
|
|
|
import { Launcher } from 'comp/launcher';
|
2016-04-19 20:48:49 +02:00
|
|
|
|
2020-06-01 16:53:51 +02:00
|
|
|
const AutoTypeHelper = function () {};
|
2016-04-19 20:48:49 +02:00
|
|
|
|
2020-06-01 16:53:51 +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) {
|
2019-09-29 15:31:02 +02:00
|
|
|
const [title, id] = out.trim().split('\n');
|
2019-09-12 22:38:21 +02:00
|
|
|
windowInfo = {
|
|
|
|
id,
|
|
|
|
title
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return callback(err, windowInfo);
|
2016-04-24 22:29:28 +02:00
|
|
|
}
|
|
|
|
});
|
2016-04-19 20:48:49 +02:00
|
|
|
};
|
|
|
|
|
2019-09-15 14:16:32 +02:00
|
|
|
export { AutoTypeHelper };
|