uwonbot 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/agent.js +9 -3
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -106,9 +106,15 @@ async function loadNativeModules() {
|
|
|
106
106
|
async function getScreenSize() {
|
|
107
107
|
if (platform === 'darwin') {
|
|
108
108
|
try {
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
109
|
+
const script = `ObjC.import("CoreGraphics"); var d = $.CGMainDisplayID(); var w = $.CGDisplayPixelsWide(d); var h = $.CGDisplayPixelsHigh(d); JSON.stringify({w:w,h:h})`;
|
|
110
|
+
const { stdout } = await execAsync(`osascript -l JavaScript -e '${script}'`, { timeout: 3000 });
|
|
111
|
+
const parsed = JSON.parse(stdout.trim());
|
|
112
|
+
if (parsed.w && parsed.h) return { width: Number(parsed.w), height: Number(parsed.h) };
|
|
113
|
+
} catch {}
|
|
114
|
+
try {
|
|
115
|
+
const { stdout } = await execAsync(`system_profiler SPDisplaysDataType 2>/dev/null | grep Resolution | head -1`, { timeout: 3000 });
|
|
116
|
+
const m = stdout.match(/(\d+)\s*x\s*(\d+)/);
|
|
117
|
+
if (m) return { width: parseInt(m[1]), height: parseInt(m[2]) };
|
|
112
118
|
} catch {}
|
|
113
119
|
}
|
|
114
120
|
if (robot?.screen?.width) {
|