English · Türkçe · Website · Türkçe site
Gives an AI agent permission to see and use the desktop and the terminals open on it. Built on Linux first (KDE, GNOME, X11, Sway, Hyprland); the same commands run on Windows and macOS too. Any agent that can run a shell command works out of the box: Claude Code, Codex, Aider, opencode, your own script, or a local model without tool calling.
- 0.1 s PipeWire screenshots + 3 ms identity-proof refs — reads AT-SPI / UIA / AX trees first; refuses stale or ambiguous targets (
STALE_REF,AMBIGUOUS_TARGET) instead of blind coordinate clicks. - Batching +
--afterdiffs (do) — chain click → fill → wait in one call and get only+/-/~UI changes back, cutting model turns and tokens. - Live terminal control — read and send input to already-open
Konsole,tmux,Terminal.app,iTerm2, and Windows console sessions alongside GUI apps. - Parallel agents with visible cursors (
--agent NAME) — each agent gets its own daemon, colored click-through cursor, and serialized input lease without hijacking your mouse.
$ computer-use-linux observe
Windows (6) — * active:
* org.kde.konsole 1920x1080+1080+0 api : claude — Konsole
firefox 1920x1080+1080+0 Player — Mozilla Firefox
...
Open terminals (4):
konsole:7891:1 claude ~/projects/api api : claude
konsole:29769:1 ssh ~ deploy@staging
$ computer-use-linux term-read konsole:29769:1 # read another terminal's screen
$ computer-use-linux term-send konsole:7891:1 "run tests" --enter
$ computer-use-linux screenshot --window win:{…} # or --screen DP-4 | --region X Y W H
$ computer-use-linux click 412 230 --from-shot # click the pixel you saw in the image
$ computer-use-linux type "Hello world — ğüşıöç"| Linux | Windows | macOS | |
|---|---|---|---|
| Every window on screen — title, app, geometry; focus, minimize, close | KWin · hyprctl · swaymsg · EWMH | EnumWindows | CGWindowList + AX |
| Real mouse — click, right/double-click, scroll, drag; pointer returns where it was | XTEST · RemoteDesktop portal · Sway IPC | SendInput | CGEvent |
| Real keyboard — shortcuts, text in any language | XTEST · portal + clipboard · wtype | SendInput (Unicode) | CGEvent (Unicode) |
| Press a button by name — the mouse does not move | AT-SPI | UI Automation | Accessibility (AX) |
Launch Electron/Chromium with accessibility on — computer-use-linux launch |
flag + environment | flag | flag |
| Open terminals — read and type into another agent, ssh session, or build | Konsole D-Bus, tmux | console buffer (AttachConsole) | Terminal.app, iTerm2, tmux |
| Its own terminal — run a command and read output | tmux / PTY | cmd.exe | tmux / PTY |
| Visible agent cursor — see where the agent acts; never touches your mouse or blocks clicks | X11/XWayland window · your cursor theme | layered window · system arrow | NSWindow · system arrow |
Screenshots — ~0.1 s; active monitor, single window, or region (--screen, --region); click by image coordinates |
PipeWire stream (one per monitor) · spectacle · grim · Xlib | GDI | screencapture |
Parallel agents — --agent NAME: each agent gets its own daemon, cursor color, and screenshot state |
Material Bibata cursors · own daemon | layered window | NSWindow |
tree takes a snapshot on every read and assigns each actionable element a ref tied to that read:
$ computer-use-linux tree --window win:{…} -i
# snapshot @s7k2m9qx — Calculator
[frame] Calculator
[button] 7 <click> ref=@s7k2m9qx:e4
[button] Clear <click> ref=@s7k2m9qx:e11
$ computer-use-linux click @s7k2m9qx:e4Behind a ref sits identity proof rather than screen coordinates: the window's process and title, the element's role, stable name, and named ancestors. Right before acting, the live tree is re-read and matched against that proof. Even if another button is inserted and the list shifts, the ref still finds the same element. If it cannot be verified, nothing is clicked: STALE_REF (element gone) or AMBIGUOUS_TARGET (multiple matches now) is returned so the agent re-reads tree. Disabled controls wait up to 5 s (CUL_WAIT) before returning TIMEOUT. In dense applications, tree --root @s…:e3 -i scopes the read to a subtree.
Every CLI call used to spawn a new Python process, open a fresh D-Bus/AT-SPI connection, and walk the window's entire tree, while the cursor animation blocked the click. In v0.7:
- Background service (default on Linux): the first
computer-use-linuxcall starts a daemon, and subsequent calls talk to the warm service — cutting per-call process overhead in half. The service reloads automatically when code changes and shuts down after 10 min idle. Control it withcomputer-use-linux service status|stop, or disable withCUL_SERVICE=0. - Ref fast path: before clicking, only the target node and its ancestors along the stored path are inspected; if identity proof holds, the rest of the tree is skipped (18 ms → 3 ms in the GTK test app). Falls back to a full scan if needed. Set
CUL_STRICT=1to force a full scan on every action. - Cursor does not block clicks: the agent cursor glides for ~80 ms (
CUL_CURSOR_MS) while the real click fires immediately; if the cursor daemon is not running, it starts in the background. - Fewer model turns:
$ computer-use-linux do 'click-text "New"' 'fill @s…:e9 "report.txt" --enter' 'wait --element Saved' --after
[1] ✓ click-text "New"
[2] ✓ fill @s…:e9 "report.txt" --enter
[3] ✓ wait --element Saved
# after @s7q… — Document
+ [button] Close ref=@s7q…:e4--after prints what changed after the action (new elements with their refs), eliminating a separate verification turn. wait polls the condition internally. cul_batch in MCP and POST /batch in HTTP expose the same flow.
CUL_TRACE=1 prints per-step timings; computer-use-linux bench measures p50/p95 latencies.
- 0.1 s screenshots: frames are pulled from an open PipeWire stream (one stream per monitor on multi-display setups). Defaults to the active window's monitor so text isn't crushed across three displays. Use
--region X Y W Hfor a close-up, or--screen DP-4 | allfor another display.
When multiple agents share a machine, mouse and keyboard events serialize through an input lease: one agent's keystrokes never land in the middle of another's drag. The lease is held only while sending input.
$ computer-use-linux --agent research screenshot
$ computer-use-linux --agent writer type "text" --window win:{a41f…}Each agent name gets its own background service: one agent blocking in wait/do does not stall another (4.75 s on a shared service vs 0.2 s across separate agents). Each agent renders its own cursor process in a distinct color — Material Bibata variants when installed (Sunset, Sky Blue, Pink Rose…), skipping the user's own theme. --from-shot resolves coordinates against that agent's own latest screenshot. type/key --window raises the window and types inside a single lease so another agent cannot steal focus mid-sequence.
These two ideas were adapted from agent-desktop (Apache-2.0) and rewritten in Python for Computer Use Linux.
No root or admin required. On Wayland, the desktop prompts once for mouse and keyboard access; on macOS, Accessibility and Screen Recording permissions are granted once. Windows and X11 require no extra prompts.
Linux
git clone https://github.com/m3lonxd/computer-use-linux
cd computer-use-linux
./install.sh # installs commands under ~/bin, lists missing packages
computer-use-linux setup # enables accessibility; in the Wayland prompt,
# check "Allow restoring…" → Share
computer-use-linux caps # shows what is activeIf you prefer pip, install with system site packages so python3-dbus and python3-gi remain visible: pipx install --system-site-packages .
Windows (Python 3.9+)
git clone https://github.com/m3lonxd/computer-use-linux
cd computer-use-linux
py -m pip install .[all] # pulls in comtypes (UI Automation) automatically
computer-use-linux capsmacOS (Python 3.9+)
git clone https://github.com/m3lonxd/computer-use-linux
cd computer-use-linux
python3 -m pip install '.[all]'
computer-use-linux setup # triggers Accessibility + Screen Recording prompts
computer-use-linux capsFull system dependencies: docs/DEPENDENCIES.md.
| Agent | Connection |
|---|---|
| Any harness that runs shell commands | Add computer-use-linux skill output to your system instructions |
| MCP client (Claude Code, Claude Desktop, Cursor) | claude mcp add computer-use-linux -- ~/bin/computer-use-linux-mcp — 32 tools (including cul_batch; legacy computer_use_linux_click* aliases for cul_click*) + live resources (cul://windows, cul://terminals, cul://tree/{ref}); screenshots return as images |
| Remote agent over HTTP | CUL_TOKEN=… computer-use-linux-http --port 8788, or as a service via deploy/install-service.sh |
| Model without tool calling | computer-use-linux-agent --model-cmd "ollama run qwen2.5" --goal "…" |
deploy/install-service.sh installs the HTTP adapter as a systemd user service that starts and stops with your graphical session. A token is generated at ~/.config/computer-use-linux/http.token with 0600 permissions so it never appears on the command line. It binds to 127.0.0.1 by default; an SSH tunnel is the safest way to connect remotely:
deploy/install-service.sh # 127.0.0.1:8788 on this machine
ssh -N -L 8788:127.0.0.1:8788 user@desktop # on the remote agent's machine
deploy/install-service.sh --host 0.0.0.0 --tls-cert cert.pem --tls-key key.pem # direct network (HTTPS)
deploy/install-service.sh --uninstallExposing the service on the network requires a token of at least 24 characters. Tokens are compared in constant time, and payloads larger than 4 MB or malformed bodies return 400. Browser requests (Origin / cross-site) are rejected so a web page cannot drive localhost; when running without a token, Host must also be a local hostname.
Full command list: computer-use-linux --help. Harness matrix: docs/HARNESSES.md. Agent instructions: adapters/skill/computer-use-linux.md.
core/computer_use_linux/
computer_use_linux.py single entry point (facade); action scoping, after/wait/click_text
snapshot.py snapshot refs (@sid:eN), fast path + strict re-identification, diff
trace.py CUL_TRACE=1 step timings
lease.py input lease: single machine-wide mouse/keyboard writer at a time
platforms/ OS abstraction layer (Desktop contract, base.py)
linux.py KWin / Hyprland / Sway / X11 selection
x11.py wlroots.py X11 (XTEST, EWMH) · Sway, Hyprland IPC
windows.py Win32 + SendInput + GDI; _wincon.py console helper
macos.py Quartz CGEvent + CGWindowList + Terminal/iTerm2
kwin.py windows + cursor position (KWin script → callDBus); persistent watcher for service
portal_input.py mouse/keyboard daemon (RemoteDesktop + ScreenCast session)
terminals.py open Konsole tabs and tmux panes on the desktop
backends/gui.py AT-SPI tree (Linux), find/click by name
backends/uia.py UI Automation tree (Windows)
backends/ax.py Accessibility tree (macOS)
backends/tui.py Computer Use Linux's own tmux/PTY sessions
agent_cursor.py visible agent cursor: movement, frame rendering, daemon (Unix socket / tokenized TCP)
xcursor.py cursor backend, Linux (X11/XWayland, click-through)
wincursor.py cursor backend, Windows (layered window, WS_EX_TRANSPARENT)
maccursor.py cursor backend, macOS (ctypes objc, ignoresMouseEvents)
adapters/ cli (+ background service) · mcp · http · skill
tests/run_all.shTests that inject input run inside an isolated desktop launched by tests/sandbox.sh: separate D-Bus, virtual KWin, separate portal and PipeWire. Your real screen, mouse, and permissions are untouched. Even the permission dialog is accepted using Computer Use Linux's own accessibility reader.
- X11: inside headless
Xvfb(tests/x11_sandbox.sh). - Sway: inside real headless Sway (
tests/sway_sandbox.sh): Sway IPC mouse, Turkish text viawtype,grim, window actions. Hyprland runs against a fakehyprctl. - Windows: real Windows Python under Wine with a dedicated prefix and headless display (
tests/wine/setup.shonce, thentests/wine/run.sh tests/test_windows_wine.py): launches real Notepad andcmd.exe. - Snapshot refs: path drift, deleted/duplicate nodes, app index shifts, auto-wait, and cross-process input lease with a fake tree (
tests/test_snapshot.py). - macOS: Quartz/AX calls tested against a fake library (
tests/test_macos_logic.py). - Electron: opens a real Electron window in the sandbox and clicks its button by tree ref (
CUL_ELECTRON=/path/to/electron; skipped if unset). - AT-SPI fast path: real GTK app in
Xvfbcovering path drift, missing/duplicate nodes, strict mode,after,wait, andfill(tests/test_atspi_fast.py). - Speed: daemon,
do, latency budgets, tmux fixes, agent loop (tests/test_speed.py).
- Linux: tested on a real KDE Plasma 6 Wayland desktop, X11 in
Xvfb, real headless Sway 1.10, and fake IPC for Hyprland. On GNOME, window listing falls back to AT-SPI only. - Windows: tested on Wine 10; not yet verified on physical Windows 10/11. Because Wine's UI Automation does not walk control trees, click-by-name could not be exercised there. Elevated windows can only be controlled by an elevated Computer Use Linux process (UIPI).
- macOS: implemented and logic-tested against fake Quartz, not yet verified on a real Mac — preview release.
- Konsole D-Bus exposes only the visible screen; scrollback history requires
tmux. - Electron/Chromium apps only expose their accessibility tree when launched with
--force-renderer-accessibility;computer-use-linux launch <program>adds the flag automatically. It cannot be enabled on an already-running app without restarting it. Firefox-based browsers publish their tree by default. Games and canvas apps use screenshots plus coordinate clicks. - v0.7's persistent KWin window watcher, single-command click + pointer restore in the Wayland input daemon, and daemon-side frame cropping have not yet been run on a physical KDE desktop (tested with a fake daemon); the watcher validates itself against a one-shot read and falls back to the legacy path if they diverge (
CUL_KWIN_WATCH=0disables it). The background service defaults to off on macOS and Windows (CUL_SERVICE=1enables it). - The visible agent cursor on Linux requires X11/XWayland (invisible on pure Wayland without XWayland; clicking still works).
Contributions are welcome — bug fixes, new desktop/compositor backends, and real-hardware testing on Windows, macOS, and Linux desktops are the most useful right now.
- New here? Start with a
good first issue, or pick something fromhelp wanted. - Please star the repository before claiming an issue or opening a pull request; external PRs are checked by
star-check. - Setup, tests, and conventions: CONTRIBUTING.md. Security reports: SECURITY.md.
If Computer Use Linux is useful to you, a star helps other people find it.
Zen Browser Lite (site) · NexGuard (site) · MAD68 HE Studio · Colab LLM Launcher · YouTube
Maintained by m3lon (m3lonxd) · MIT