OpenProgram Docs

Linux and Windows backends

Linux backend

LinuxComputer keeps MacComputer's interface, so the tool, the server's app lookup and the tests drive either one through backends.backend(). It runs only in an X11 session: under Wayland no client may read or inject input into another client's surface, and support() says so.

Item
AppsThe AT-SPI desktop's children that own a window, plus top-level X windows whose owner does not join the accessibility bus. The owner of an X window is _NET_WM_PID, or, for Xt and Motif clients that do not set it, the newest process whose name or executable starts with the window's WM_CLASS instance.
App identityA running app takes its desktop entry (Gio.AppInfo) only by its own desktop id; an app that is not running is matched to one by executable or name, the entry a launch would start. The entry gives the identifier (org.gnome.Calculator), the display name, and the icon looked up in the hicolor theme. Launching goes through Gio.DesktopAppInfo.launch and then waits for the app's AT-SPI root as well as its window, since GTK 4 apps join the bus after mapping.
WindowsTop-level windows are the window manager's _NET_CLIENT_LIST (read with xprop), which leaves out GTK's 10×10 client-leader window; without a client list, windows of 10×10 or smaller are skipped. An AT-SPI frame is paired with its X window by title, then by size. A window missing from the mapped set is reported minimized; show_window maps it again.
TreeRoles are AT-SPI role names (push button, text, check box), so role_name prints them unchanged. A subtree is read when it is on screen: GTK 3 sets SHOWING, GTK 4 sets only VISIBLE below the window, so the walk uses SHOWING when any child of the window reports it and VISIBLE otherwise. A closed combo box's popup items and GTK's tooltip window are skipped.
Tree filteringUnnamed fillers, panels and sections are transparent. GTK 4 names unnamed widgets after their class (AdwGizmo, GtkMenuButton); such names are not labels.
FlagsFlags come from states (CHECKED or PRESSED, FOCUSED, SELECTED, EXPANDED, not ENABLED/SENSITIVE), settable from EditableText or Value, secure from the password text role. Secondary actions are the element's Action names other than click, press, activate, toggle, jump, open and select.
Element actions in the backgroundClick runs the element's primary action; set_value uses EditableText.set_text_contents, Value.set_current_value, or a toggle when a check box's state differs; type_text and paste insert at the caret with EditableText.insert_text (UTF-8 byte length), replacing a selection, and a newline runs the field's activate action; press_key Return on a field runs activate
Selection, scroll, menuselect_text uses Text.set_selection or the caret offset (character offsets, not UTF-16); copy reads Text.get_selection without the clipboard; scroll by element moves the nearest scroll bar's Value by 90 % of its length per page; menu walks the window's menu bar and runs a leaf's action.
FocusComponent.grab_focus makes GTK present the window, so wherever focus has to move, the window that was active gets focus back.
Foreground inputGTK and Qt read pointer and key input through XInput 2 and ignore core events sent with XSendEvent to an unfocused window, so a coordinate click, drag, wheel scroll, hover or key press is sent with XTEST: the window is activated (windowactivate, or windowraise plus windowfocus without an EWMH window manager), the input runs, and the pointer position, the windows that stood over it and the previously active window are restored; hover leaves the pointer.
ChordsChords use xdotool names with cmd, command, meta and win mapped to super and option to alt.
ScreenshotsGdk.pixbuf_get_from_window on a foreign X window gives the window's own pixels at X resolution, scaled down to 1568 pixels on the long side; a minimized window has none. Screenshot pixels map to screen pixels through the window's position from xdotool getwindowgeometry, the same frame AT-SPI's screen extents use.
OCRFor sparse windows (and the find fallback), tesseract --psm 11 tsv with the installed languages among eng, chi_sim, chi_tra, jpn and kor; words with confidence 30 or more are joined into lines. Contour shapes are not detected on Linux.
Audiopactl list sink-inputs gives each stream's application.process.id; the recorder polls until a stream of the app or any of its descendants (re-read on every poll, since players are usually children started after recording began) appears, then reads it with parec --monitor-stream=<index> as 16 kHz mono float. Reading continues until parec ends, so the samples it buffers when stop terminates it are kept.
Audio latencyUnder PipeWire the first samples arrive within a quarter second; under PulseAudio's timer-based scheduling the first monitor of a stream starts 1.2–1.7 s late and that span is lost.
Refusalspassword text elements, Seahorse, KWallet, gcr prompts, polkit agents and OpenProgram's own entries.
Item
Target noteThe app target's note on Linux (_NOTES in providers/window/platforms.py) arrives with the first call to it: which steps bring the window forward, plain-text paste, clipboard-free copy, no open_file (a call to it answers NOT_SUPPORTED: naming File > Open or ctrl+o), applications without accessibility.
Apps replyThe computer_use_apps WebSocket reply carries the worker's platform, and on Linux the approval card states for coordinate input, drags, hovers and keys other than Return (needsForeground) that the window comes forward for that step.

Windows backend

WindowsComputer keeps the same interface. The process is per-monitor DPI aware (SetProcessDpiAwarenessContext(-4)), so window frames, UI Automation bounds and input coordinates are all physical screen pixels. Every Win32 function it calls has its restype and argtypes declared, so 64-bit handles pass intact.

Item
AppsTop-level windows from EnumWindows that are visible, unowned, not tool windows and titled, grouped by process. A UWP frame (ApplicationFrameWindow) belongs to ApplicationFrameHost; its app is the process of the Windows.UI.Core.CoreWindow child. Installed apps are Get-StartApps (desktop and Store alike, cached for a minute); a running process takes a row only by its own app id, one not running by executable or name, and launching runs explorer.exe shell:AppsFolder\<AppID>, then waits for a new window.
TreeIUIAutomation.ElementFromHandle on the window, walked with the control view walker; offscreen subtrees are skipped except menu items. Roles are the control types (50000–50040) named in lower case (button, edit, check box). Unnamed panes, groups and custom elements without actions are transparent.
FlagsFlags come from patterns: Toggle state, IsEnabled, HasKeyboardFocus, SelectionItem, ExpandCollapse, a writable Value or a RangeValue (settable), IsPassword (secure). Values come from RangeValue, Value or the Text pattern's document range. Secondary actions are expand, collapse, scroll, select and a LegacyIAccessible default action other than press, click, invoke or jump.
Element actions in the backgroundClick tries Invoke, Toggle, SelectionItem.Select, ExpandCollapse and LegacyIAccessible.DoDefaultAction in order, and focuses an edit; set_value uses Toggle, RangeValue, Value or LegacyIAccessible; select_text moves a Text pattern range by characters; copy reads the Text pattern's selection; scroll by element uses the nearest Scroll pattern by large increments; menu walks a classic HMENU (GetMenu) and posts WM_COMMAND, or expands and invokes UI Automation menu items.
Posted inputA coordinate click, drag, wheel scroll or hover is posted as mouse messages to the deepest child window under the point (ChildWindowFromPointEx), in its client coordinates; a second click is WM_LBUTTONDBLCLK. A key without named modifiers is WM_KEYDOWN/WM_CHAR/WM_KEYUP to the thread's focus window (GetGUIThreadInfo); type_text posts WM_CHAR per UTF-16 unit. paste into a classic edit or rich edit control sends WM_PASTE.
Foreground inputShortcuts read GetKeyState, which posted messages do not change, and UWP frames, Chromium and Firefox windows read raw input, so a chord with modifiers, pointer input to those window classes, and paste elsewhere use SendInput inside _Forward: it joins the foreground thread's input queue (AttachThreadInput) to call SetForegroundWindow, runs the input, and then puts back the cursor, the previous foreground window and the window's place under the one it stood under.
ScreenshotsPrintWindow with PW_RENDERFULLCONTENT renders the window, covered or not, into a bitmap the size of its outer rectangle; the visible frame (DWMWA_EXTENDED_FRAME_BOUNDS) is cut from it and scaled with StretchBlt in HALFTONE mode to 1568 pixels on the long side, then GetDIBits gives BGRA rows that png_encode writes as a PNG without any imaging library. A minimized window has no screenshot; show_window restores it with SW_SHOWNOACTIVATE.
Clipboardpaste writes CF_UNICODETEXT and, for md and html, the "HTML Format" payload whose header offsets cf_html computes, and restores the previous text afterwards.
OCRAs on Linux, tesseract when it is installed.
AudioActivateAudioInterfaceAsync on VAD\Process_Loopback with PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE gives an IAudioClient initialised in shared loopback mode with auto-conversion to 16 kHz mono float, read event-driven through IAudioCaptureClient on its own COM thread. The completion handler is an agile COM object, since Windows calls it on a worker thread.
RefusalsIsPassword elements, CredentialUIBroker, consent (UAC), LogonUI, LockApp, credwiz, keymgr and OpenProgram.
Target note and cardThe app target's note on Windows says which input brings the window forward and that super is the Windows key, and the approval card says for a chord or a paste (needsForeground(args, "windows")) that the window comes forward for that step.

Relation to cua-driver

Item
cua-drivercua-driver (trycua/cua, MIT) is the open-source driver closest to these backends: one Rust runtime for macOS, Windows and Linux, reached over MCP (cua-driver mcp) or in process through its Python SDK (cua_driver, UniFFI over a native library).
StanceThe backends keep their own code and take recipes from it instead of embedding it:
Item
DeliveryBackground delivery on macOS follows its recipe (macOS delivery), so embedding it would not change how a click arrives.
SpeedThe in-process SDK loads in about 0.8 s and answers window and app listings in under 10 ms, so speed is not the obstacle.
Size and churnThe cost is size and churn: the macOS wheel holds a 64 MB library and an 82 MB executable, and the package moved through more than 40 minor versions in 0.x.
Cursor and telemetryThe in-process runtime draws no agent cursor on macOS, and it sends product telemetry unless turned off.
Above the driverThe behaviour these backends are tuned for (stable indices, replaced elements found again, a busy application, settling, the window marker, refusals) sits above the driver and would stay ours either way.

cua-driver joins as a provider of its own, cua_driver, behind one adapter (Machines and targets): offered for local in place of desktop, and app and screen keep their names. A local Wayland session, which the Linux backend refuses, is operated as screen through the desktop portal, by pixels.

Implementation status

StateScope
Implementedthe Linux (X11) backend. Tested in a Debian 12 container with Xvfb, Openbox, the AT-SPI bus and PipeWire against a GTK 3 window (menu bar, entry, password entry, check box, slider, scrolled text view, drawing area, a button that plays sound from a child process), GNOME Calculator (GTK 4 with libadwaita, launched from its desktop entry, 7×6 computed by element clicks) and ImageMagick display (an Xt client without AT-SPI, read by OCR). Host-independent parts have unit tests.
Implemented, not yet run on Windowsthe Windows backend described above. The macOS machines it is built on have no Windows guest, so only its host-independent parts (PNG encoding, key mapping, the HTML clipboard payload, Start menu parsing, the control-type table, refusals, the recording format) have unit tests.
Not implementedscreen on Linux and Windows, and the cua_driver and wayland_portal kinds: see the status of Machines and targets.

Computer and browser use

Last updated · 2026-11-25