forked from sentialx/node-window-manager
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.js
More file actions
32 lines (24 loc) · 778 Bytes
/
example.js
File metadata and controls
32 lines (24 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { windowManager } = require("./dist/index");
console.log(windowManager.requestAccessibility()); // required on macOS
const window = windowManager.getActiveWindow();
console.log(window.getTitle());
const bounds = window.getBounds();
console.log(bounds);
window.setBounds({ x: 0, y: 0 });
window.maximize();
setTimeout(() => {
window.setBounds(bounds);
}, 1000);
console.log("Windows list");
windowManager.getWindows().forEach((window) => {
if (window.isVisible()) {
console.log(window.getTitle(), window.path);
}
});
windowManager.on("window-activated", (window) => {
console.log(window.path);
});
console.log("Monitors list");
windowManager.getMonitors().forEach((monitor) => {
console.log(monitor.getWorkArea());
});