Expand description
Library half of the wdotool binary. The thin main.rs wires
argv → cli::Cli → dispatch, but everything testable lives here so
integration tests in tests/ can drive dispatch against a mock
backend without spawning a subprocess.
The two public entry points worth knowing:
dispatchruns a parsedCommandagainst an arbitraryBackend, writing all human-readable output to the writers inDispatchCtx. It returns anExitCode— the binary translates non-zero intoprocess::exit, tests just assert on it.SearchFiltersis exposed so the existing search unit tests can keep their friendly module-private feel without re-deriving the filter logic.
Re-exports§
Modules§
- cli
- diag
wdotool diag: environment + backend availability report.- record
wdotool record— capture user input until Ctrl-C (or--max-durationelapses) and write the events as JSON.- replay
wdotool replay <file>— read a capturedRecEventtrace and dispatch each event through the active backend, reproducing the original timing.
Structs§
- Dispatch
Ctx - Output sinks + environment passed to
dispatch. The binary fills these withio::stdout()/io::stderr(); tests fill them withVec<u8>so they can assert on captured output. - Exit
Code - Wraps a process exit status.
0is success; non-zero is reserved for the xdotool-compatible “no match / unsupported on this backend” signals (search with no results, getmouselocation on a send-only backend, getwindow* with a missing field).dispatchreturns this instead of callingprocess::exitdirectly so tests can run inside the same process. - Search
Filters - Compiled search predicates. Built once per
wdotool searchcall and then applied to each window. Holding the regex(es) here avoids recompiling per-window. - Search
Flags - Inputs to
SearchFilters::compile; mirrors the CLI flags so the filter compilation is testable without round-tripping through clap.
Functions§
- dispatch
- Run a parsed command against a backend. Returns a structured exit
code instead of terminating the process; the binary calls
process::exiton non-zero, tests assert directly. - init_
tracing