Detect mouse move and key press event for all over the window screen

How to detect mouse move and key press event for all over the window screen ?
I want to achieve idle screen time functionality. Is there any better way to handle this scenario.

You can just listen to events like mousemove/keypress, for example:

webix.event(window, "mousemove", () => {
  // ...
});

webix.event(window, "keypress", () => {
  // ...
});

// or attach listeners to some other element