|
1 |
| -const { windowManager } = require("./dist/index"); |
2 |
| - |
3 |
| -console.log(windowManager.requestAccessibility()); // required on macOS |
4 |
| - |
5 |
| -const window = windowManager.getActiveWindow(); |
6 |
| -console.log(window.getTitle()); |
7 |
| - |
8 |
| -const bounds = window.getBounds(); |
9 |
| -console.log(bounds); |
10 |
| - |
11 |
| -window.setBounds({ x: 0, y: 0 }); |
12 |
| -window.maximize(); |
13 |
| - |
14 |
| -setTimeout(() => { |
15 |
| - window.setBounds(bounds); |
16 |
| -}, 1000); |
17 |
| - |
18 |
| -console.log("Windows list"); |
19 |
| -windowManager.getWindows().forEach((window) => { |
20 |
| - if (window.isVisible()) { |
21 |
| - console.log(window.getTitle(), window.path); |
22 |
| - } |
23 |
| -}); |
24 |
| - |
25 |
| -windowManager.on("window-activated", (window) => { |
26 |
| - console.log(window.path); |
27 |
| -}); |
28 |
| - |
29 |
| -console.log("Monitors list"); |
30 |
| -windowManager.getMonitors().forEach((monitor) => { |
31 |
| - console.log(monitor.getWorkArea()); |
32 |
| -}); |
| 1 | +const { windowManager } = require("./dist/index"); |
| 2 | + |
| 3 | +console.log(windowManager.requestAccessibility()); // required on macOS |
| 4 | + |
| 5 | +const window = windowManager.getActiveWindow(); |
| 6 | +console.log(window.getTitle()); |
| 7 | + |
| 8 | +const bounds = window.getBounds(); |
| 9 | +console.log(bounds); |
| 10 | + |
| 11 | +window.setBounds({ x: 0, y: 0 }); |
| 12 | +window.maximize(); |
| 13 | + |
| 14 | +setTimeout(() => { |
| 15 | + window.setBounds(bounds); |
| 16 | +}, 1000); |
| 17 | + |
| 18 | +console.log("Windows list"); |
| 19 | +windowManager.getWindows().forEach((window) => { |
| 20 | + if (window.isVisible()) { |
| 21 | + console.log(window.getTitle(), window.path); |
| 22 | + } |
| 23 | +}); |
| 24 | + |
| 25 | +windowManager.on("window-activated", (window) => { |
| 26 | + console.log(window.path); |
| 27 | +}); |
| 28 | + |
| 29 | +console.log("Monitors list"); |
| 30 | +windowManager.getMonitors().forEach((monitor) => { |
| 31 | + console.log(monitor.getWorkArea()); |
| 32 | +}); |
0 commit comments