Registers an event listener on the specified event. Supported system event types are:
- application-closed
- application-crashed
- application-created
- application-started
- desktop-icon-clicked
- idle-state-changed
- monitor-info-changed
- session-changed
- window-blurred
- window-focused
Example
fin.desktop.System.addEventListener('monitor-info-changed', function (evnt) {
console.log("The monitor information has changed to: ", evnt);
}, function () {
console.log("The registration was successful");
},function (err) {
console.log("failure: " + err);
});
System Events
application-closed
Generated when an application has closed.
//This response has the following shape:
{
topic: "system",
type: "application-closed",
uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52" // the UUID of the application
}
application-crashed
Generated when an application has crashed.
//This response has the following shape:
{
topic: "system",
type: "application-crashed",
uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52" // the UUID of the application
}
application-created
Generated when an application is created.
//This response has the following shape:
{
topic: "system",
type: "application-created",
uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52" // the UUID of the application
}
application-started
Generated when an application has started.
//This response has the following shape:
{
topic: "system",
type: "application-started",
uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52" // the UUID of the application
}
external-application-connected
Generated when an external application has connected
{
topic: "system",
type: "external-application-connected",
uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52" // the UUID of the external application
}
external-application-disconnected
Generated when an external application has disconnected
{
topic: "system",
type: "external-application-disconnected",
uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52" // the UUID of the external application
}
desktop-icon-clicked
Generated when the desktop icon is clicked while it's already running.
//This response has the following shape:
{
mouse: {
left: 13, //the left virtual screen coordinate of the mouse
top: 14 // the top virtual screen coordinate of the mouse
},
tickCount: 233000, //the number of milliseconds that have elapsed since the system was started,
topic: "system",
type: "desktop-icon-clicked",
uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52" // the UUID of the application launching
}
idle-state-changed
Generated when a user enters or returns from idle state. This method is continuously generated every minute while the user is in idle. A user enters idle state when the computer is locked or when there has been no keyboard/mouse activity for 1 minute. A user returns from idle state when the computer is unlocked or keyboard/mouse activity has resumed.
//This response has the following shape:
{
elapsedTime: 6000, //How long in milliseconds since the user has been idle.
isIdle: true, //true when the user is idle,false when the user has returned;
topic: "system",
type: "idle-state-changed"
}
monitor-info-changed
Generated on changes of a monitor's size/location. A monitor's size changes when the taskbar is resized or relocated. The available space of a monitor defines a rectangle that is not occupied by the taskbar.
//This response has the following shape:
{
nonPrimaryMonitors: [{
availableRect: {
bottom: 55, //bottom-most available monitor coordinate,
left: 55, //left-most available monitor coordinate,
right: 55, //right-most available monitor coordinate,
top: 55 //top-most available monitor coordinate
},
deviceId: "device", //device id of the display
displayDeviceActive: true, //true if the display is active
monitorRect: {
bottom: 55, //bottom-most monitor coordinate,
left: 55, //left-most monitor coordinate,
right: 55, //right-most monitor coordinate,
top: 55 //top-most monitor coordinate
},
name: "display two" //name of the display
}],
primaryMonitor: {
availableRect: {
bottom: 55, //bottom-most available monitor coordinate,
left: 55, //left-most available monitor coordinate,
right: 55, //right-most available monitor coordinate,
top: 55 //top-most available monitor coordinate
},
deviceId: "device", //device id of the display
displayDeviceActive: true, //true if the display is active
monitorRect: {
bottom: 55, //bottom-most monitor coordinate,
left: 55, //left-most monitor coordinate,
right: 55, //right-most monitor coordinate,
top: 55 //top-most monitor coordinate
},
name: "display one" //name of the display
},
reason: "display", //the action that triggered this event. Can be "taskbar", "display" or "unknown"
taskbar: {
edge: "top" // which edge of a monitor the taskbar is on,
rect: {
bottom: 55, //bottom-most coordinate of the taskbar
left: 55, //left-most coordinate of the taskbar
right: 55, //right-most coordinate of the taskbar
top: 55 //top-most coordinate of the taskbar
}
},
topic: "system",
type: "monitor-info-changed",
virtualScreen: {
bottom: 55, //bottom-most coordinate of the virtual screen,
left: 55, //left-most coordinate of the virtual screen,
right: 55, //right-most coordinate of the virtual screen,
top: 55 //top-most coordinate of the virtual screen
}
}
session-changed
Generated on changes to a user’s local computer session.
//This response has the following shape:
{
reason: "lock", //the action that triggered this event:
//"lock"
//"unlock"
//"remote-connect"
//"remote-disconnect"
//"unknown"
topic: "system",
type: "session-changed"
}
window-blurred
Generated when a window loses focus.
//This response has the following shape:
{
name: "windowName",
topic: "system",
type: "window-blurred",
uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52" // the UUID of the application
}
window-focused
Generated when a window gains focus.
//This response has the following shape:
{
name: "windowName",
topic: "system",
type: "window-focused",
uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52" // the UUID of the application
}