A cross-platform desktop automation CLI optimized for LLM agents. Control desktop applications through native accessibility APIs on Windows, Linux, and macOS.
| Platform | Accessibility API | Input Simulation | Status |
|---|---|---|---|
| Windows | UI Automation (UIA) | SendInput | Stable |
| Linux | AT-SPI2 + X11 | enigo (libxdo) | Stable |
| macOS | Cocoa Accessibility | enigo (CGEvent) | In Development |
# Install
cargo install desktop-cli
# List windows
desktop windows
# Get a compact UI summary (optimized for LLM consumption)
desktop summary notepad- Cross-Platform: Native accessibility APIs on Windows, Linux, and macOS
- LLM-Optimized Output: Compact, categorized UI summaries that maximize signal-to-noise ratio
- Enhanced Query Language: Intuitive
@roleselector syntax designed for AI agents - Smart Window Targeting: Target windows by name, title, index, or let the CLI auto-disambiguate using element selectors
- Semantic Role Detection: Automatic classification of UI elements (button, input, menu, etc.)
- Spatial Queries: Find elements by position relative to other elements
# Discover windows
desktop windows --exe firefox
# Get UI state (use after every action)
desktop summary :1
# Find elements
desktop query notepad "@button 'Save'"
# Interact
desktop click notepad "@button 'Save'"
desktop type notepad "#editor" --value "Hello World"
desktop keys notepad "ctrl+s"
desktop scroll notepad down --amount 5
# Combined action
desktop do notepad click "@button 'Save'"| Query | Description |
|---|---|
:1, :2 |
Window by index |
notepad |
Match by executable name |
title:PCB |
Match by window title |
hwnd:0x1234 |
Match by HWND |
pid:12345 |
Match by process ID |
title:*Draft* |
Wildcard matching |
When multiple windows match, the CLI tries the element selector on each and auto-selects the right one.
Desktop CLI is designed as a tool for LLM agents to control desktop applications:
- Start with
desktop windowsto discover available windows - Use
desktop summaryafter every action to understand UI state changes - Use
@roleselectors (@button "Save",@input:first) for reliable element targeting - Use
desktop dofor combined find-and-act operations - Use
--jsonoutput for machine-readable responses
See AGENT.md for detailed LLM agent instructions.
Full documentation is available at akiselev.github.io/desktop-cli.
# Build
cargo build
# Unit tests
cargo test --lib
# Linux E2E tests (Docker)
docker build -t desktop-cli-test .
docker run --rm --init desktop-cli-testGPL-3.0-only