Node keyboard and mouse activity detector without root!
Gets list of all xinput devices
- callback - function - callback function
Creates new listener for devices
- good_devices_id_list - array of numbers - list of devices id (you can get it from xinput_get_all_devices_id)
- callback - function - callback function
- response_interval - number - time interval for sending list of events to callback. If 0 is set, live mode is active
Destroys all streams and clears class
Calls callback with list of events every N seconds
When any event triggers, it creates new event list with this event calls callback immediately. For new call is made for every event.
npm install xinput-mouse-key-logger
import {xinput_events_list, xinput_get_all_devices_id, xinput_listener} from 'xinput-mouse-key-logger';
xinput_get_all_devices_id((devices_id_list: number[])=> {
var listener = new xinput_listener(devices_id_list, (xinput_events_list: xinput_events_list)=> {
console.log('events!', xinput_events_list);
});
// Destroys listener after 10 sec
setTimeout(function () {
listener.destroy();
}, 10000);
});
const xmkl = require('xinput-mouse-key-logger');
xmkl.xinput_get_all_devices_id(function (devices_id_list) {
console.log('all', devices_id_list);
var listener = new xmkl.xinput_listener(devices_id_list, function (xinput_events_list) {
console.log('events!', xinput_events_list);
});
// Destroys listener after 10 sec
setTimeout(function () {
listener.destroy();
}, 10000);
});
import {xinput_events_list, xinput_get_all_devices_id, xinput_listener} from 'xinput-mouse-key-logger';
xinput_get_all_devices_id((devices_id_list: number[])=> {
var listener = new xinput_listener(devices_id_list, (xinput_events_list: xinput_events_list)=> {
console.log('events!', xinput_events_list);
}, 0); // <- 0 is set, live mode is active!
});
const xmkl = require('xinput-mouse-key-logger');
xmkl.xinput_get_all_devices_id(function (devices_id_list) {
console.log('all', devices_id_list);
var listener = new xmkl.xinput_listener(devices_id_list, function (xinput_events_list) {
console.log('events!', xinput_events_list);
}, 0); // <- 0 is set, live mode is active!
});