Skip to main content

Module control

Module control 

Source
Expand description

computer_control — pointer AND keyboard as one pipeline tool.

Collapses the former computer_pointer + computer_keyboard pair: one step is EITHER a pointer action (action + target, default click) OR a keyboard action (key/text), and steps chain via then with shell && semantics — each step runs only if the previous succeeded, the first failure aborts the chain reporting the exact failing step and everything that completed before it.

This file is ONLY the pipeline: chain walking, wait steps and step classification. The step KINDS live in their components — pointer dispatch in super::mouse, keyboard dispatch in super::keyboard — so each can be reused by other tools without carrying this pipeline along.

Targeting is PER STEP (app/pid/surface + selector on every step), which is what dissolves the focus problem the two old tools wrestled with: a real click on an element is the one mechanism that moves OS keyboard focus on every toolkit, so the canonical pipeline is click the field → then type. No focus synthesis, no gates — the click that selects IS the focus. Keystrokes go through the shared input simulator (see [super::shared_input_sim]); every call is blocking, so it runs on tokio’s blocking pool.

Constants§

CONTROL_CHAIN_MAX_DEPTH
Maximum number of steps in a then pipeline (the root step included); 8 covers every realistic sequence (click → type → enter, drag → key, …).

Functions§

control
Run a desktop-control pipeline: pointer and keyboard steps chained via then, executed sequentially in ONE call with && semantics — each step runs only if the previous succeeded, and the first failure aborts with the exact failing step and the report of what completed.