ucu-mcp 0.6.7 → 0.6.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/dist/src/utils/input.js +9 -3
- package/package.json +1 -1
package/dist/src/utils/input.js
CHANGED
|
@@ -445,11 +445,17 @@ export async function typeText(text, delay = 20, _platform = process.platform, t
|
|
|
445
445
|
}
|
|
446
446
|
flushCG();
|
|
447
447
|
flushFallback();
|
|
448
|
-
// Process each batch
|
|
448
|
+
// Process each batch — track the dispatch method used (worst-case wins: hid-tap > per-pid).
|
|
449
|
+
let lastDispatch;
|
|
449
450
|
for (const batch of batches) {
|
|
450
451
|
if (batch.cgEvent && Array.isArray(batch.chars)) {
|
|
451
452
|
if (isCgeventAvailable() || isSkylightAvailable()) {
|
|
452
|
-
runInputChecked({ command: "typeBatch", keys: batch.chars }, target);
|
|
453
|
+
const d = runInputChecked({ command: "typeBatch", keys: batch.chars }, target);
|
|
454
|
+
// If any batch went hid-tap, the overall result is hid-tap.
|
|
455
|
+
if (d === "hid-tap")
|
|
456
|
+
lastDispatch = "hid-tap";
|
|
457
|
+
else if (lastDispatch !== "hid-tap")
|
|
458
|
+
lastDispatch = d;
|
|
453
459
|
}
|
|
454
460
|
else {
|
|
455
461
|
// Build a single JXA script that types all chars in this CGEvent batch
|
|
@@ -485,7 +491,7 @@ export async function typeText(text, delay = 20, _platform = process.platform, t
|
|
|
485
491
|
], { timeout: 5000 });
|
|
486
492
|
}
|
|
487
493
|
}
|
|
488
|
-
return;
|
|
494
|
+
return lastDispatch;
|
|
489
495
|
}
|
|
490
496
|
if (_platform === "linux") {
|
|
491
497
|
await execFileAsync("xdotool", [
|