I am making an electron app to check system idle time. I want to use a common module to get idle time on winodws, mac and linux.
I am using this command to get idle time on mac but it is not working in linux. i also tried different npm plugins to get idle time but none of them is working as expected
function idleTime(callback) {
var command = `ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'`;
child_process.exec(command, function (err, stdout, stderr) {
return err ? callback(err) : callback(null, stdout.trim());
});
my expected result is to check if the user is using system or not. i wanted to calculate idle time of sysem on all platforms (mac,linux,windows).