I installed a background desktop driver on Windows from inside WSL2. Here is what worked and what did not.
Описание и применение
Автор установил драйвер cua-driver в Windows 10 из WSL2, чтобы управлять окном WeChat без переключения фокуса. Чтение UI, поиск элементов и клики работают, но ввод текста в фоне не поддерживается.
Задача
Desktop automation scripts often steal focus and move the cursor, breaking when run alongside a user. A background driver that can interact with the desktop without stealing focus is needed.
Результат
Background reading, locating, launching, and clicking work reliably on a real Chinese-language app. Background typing does not, requiring a foreground escalation or a second machine for conversational bots.
Рабочий процесс
- 1. Install cua-driver Windows executable on Windows 10.
- 2. Run the driver from a Windows process launched in WSL2.
- 3. Verify the driver opens the named pipe \\.\pipe\cua-driver and reports an attached interactive desktop.
- 4. Use the driver to read a live WeChat window (138 elements).
- 5. Perform background clicks on UI elements using stable tokens.
- 6. Observe that foreground process remains unchanged.
- 7. Attempt background typing; observe failures and error messages.
- 8. Note that a foreground escalation can temporarily bring a window to the front if needed.
Доказательства
Reading, locating, launching without fronting, and clicking all work, on a real Chinese-language app rather than a demo.
Typing in the background does not work. cmd returned background_unavailable with the reason background input is dropped by this surface, naming the class ConsoleWindowClass.
- Дата записи: 2026-09-21T15:30:31.194Z