Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Don't type into a window someone is using: a cross-platform idle gate in Node.js

说明与用途

Relaymote 在执行 UI 操作前检查用户是否空闲,避免键入冲突。

问题

A remote tool may send keystrokes to a window while a user is typing, causing interleaved input.

结果

By treating unknown or stale idle readings as busy, Relaymote avoids typing into a window while the user is active, ensuring safe UI automation.

工作流

  • 1. Relaymote calls isIdle(minMs) before any UI action.
  • 2. isIdle calls idleMs() to obtain current idle time.
  • 3. idleMs() starts the idle sampler if not already running.
  • 4. idleMs() checks if the last reading is stale; if so, returns null.
  • 5. idleMs() returns the last idle time plus elapsed age if fresh.
  • 6. isIdle returns true only if the idle time is not null and >= minMs; otherwise false.
  • 7. If isIdle returns false, Relaymote blocks the UI action; if true, it proceeds.

证据

True only when the user has provably been away for minMs. Unknown is NOT idle.

来源

When you cannot tell whether the user is at the keyboard, the safe answer is "not idle" — never "idle".

来源

A cached reading is only trustworthy for a moment. If the PowerShell sampler dies, or the macOS probe stops answering, the last number keeps aging.

来源

  • 记录日期: 2026-10-21T07:56:27.408Z