Linux

agent-desktop reads Linux apps through AT-SPI over D-Bus. The loop, refs, JSON envelope, sessions, and traces match every platform, so this page covers only what differs on Linux. GNOME is the measured desktop; X11 and Wayland sessions both work and differ in input, capture, and window control. The examples on this page ran on an X11 session (Xvfb with the openbox window manager, no GNOME Shell), so shell surfaces and notifications were not exercised.

Requirements

  • Ubuntu 24.04 or later on x86_64 or aarch64, with a glibc 2.35 floor. Other distributions need an at-spi2-core bridge with fix (commit dc0dc33); Ubuntu 22.04's bridge aborts on Action.GetActions.
  • A graphical session of the signed-in user, a running AT-SPI bus (at-spi2-core), and a window manager. Run agent-desktop from a shell inside that session: the session bus, display, and runtime directory come from its environment. A TTY login, an SSH shell without those variables, a container without a bus, or another user's session sees no apps.
  • X11 keys need XTEST, and Wayland keys need GNOME Mutter RemoteDesktop. The Wayland clipboard needs wl-clipboard.
  • On X11, clipboard-set needs agent-desktop-linux-clipboard-owner beside the binary. npm installs and release archives include it; from source, build it with cargo build --release -p agent-desktop-linux --bins.
  • A private state root. A group-writable or world-readable ~/.agent-desktop makes commands that write there fail with PERM_DENIED. Run chmod 700 on it, or let agent-desktop create it.

Check the accessibility bus

Linux has no permission dialog for accessibility; whether the bus answers gates everything. Run status first:

agent-desktop status
{
  "permissions": {
    "accessibility": { "state": "granted" },
    "automation": { "state": "not_required" },
    "screen_recording": { "state": "not_required" }
  },
  "platform": "linux",
  "supported_surfaces": ["window", "sheet", "alert", "menu"]
}
StateWhat status and list-apps showMeaning
Answered, healthyaccessibility is granted, supported_surfaces lists surfaces, list-apps returns rowsNormal
Answered, emptygranted, but list-apps returns no rowsThe bus is up and no app registered. Start an app, or restart one that started before the bus
Unavailabledenied with a suggestion, empty supported_surfaces, and commands fail with PLATFORM_NOT_SUPPORTEDThe session bus or the accessibility bus cannot be reached

An unavailable bus has four usual causes, each reported with the raw D-Bus error in platform_detail:

  • No session bus. Run inside a desktop session, or start one with dbus-run-session -- COMMAND.
  • AT-SPI not installed. Install at-spi2-core. For Flatpak add --talk-name=org.a11y.Bus; for snap connect desktop-legacy or unity7.
  • Launcher cannot start. Read systemctl --user status at-spi-dbus-bus.service.
  • Socket gone. Restart at-spi-dbus-bus.service, or log out and back in.

Judge health with status, not with busctl: on a cold session org.a11y.Bus has no owner until its first use. Do not restart a bus you did not start, because other clients on a shared host depend on it.

What works headless

Ref actions are semantic AT-SPI calls that never move the pointer or change the active window. Under --headed on X11, click, right-click, and type try physical input first and fall back to the semantic action only after a not_delivered refusal. See Headed mode.

GroupWorks headlessNeeds --headedFails closed or not supported
Observation and surfacessnapshot, find, get, is, list-surfaces, on X11 and Wayland
Ref actionsclick, right-click, type, set-value, clear, select, toggle, check, uncheck, expand, collapse, scroll-to, when the element exposes the AT-SPI capabilityfocus; type into a terminal text node; some Qt and libadwaita combos for select; a GTK4 or Qt action that opens a popup, a menu or a dialog (headless: POLICY_DENIED, check foreground)An element with no semantic route refuses and never falls back to physical input
Wheel scrollingscroll, mouse-wheel, X11 onlyHeadless scroll: POLICY_DENIED
Pointer gesturesdouble-click, triple-click, hover, drag, mouse-click, mouse-move, X11 onlyWayland: ACTION_NOT_SUPPORTED, cause wayland_session
KeyboardScoped press (--app or --window-id) on X11 and Mutter Wayland. A scoped headless press needs the target window already activeUnscoped press; a scoped press to a background app (X11)Blocked combos such as alt+f4 without --force
Held inputkey-down, key-up, mouse-down, mouse-up
App and windowlaunch, list-apps, list-windows on X11 and Wayland; window control and close-app --force on X11focus-window on X11; a graceful close-app of an app with unsaved work: the save prompt keeps the app open and is reported as dialog_pendingfocus-window and window control on Wayland: ACTION_NOT_SUPPORTED. A headless graceful close-app of a native Wayland client returns ACTION_NOT_SUPPORTED with details.cause: wayland_session. One that cannot read the focused window returns POLICY_DENIED with details.kind: focus_unreadable before any close request is sent.
Capturescreenshot, list-displaysX11 under a compositing window manager (GNOME): display and --screen captures return PLATFORM_NOT_SUPPORTED (details.reason: "compositing"); capture one window instead. Wayland: portal consent on first use, and window targets are PLATFORM_NOT_SUPPORTED
Clipboardclipboard-get (text, images, file lists)clipboard-set, clipboard-clear (text, images, file lists)Missing helper or wl-clipboard: PLATFORM_NOT_SUPPORTED
WaitAll modes; --notification on GNOME
Notificationslist-notifications, even with the list closedEvery dismiss and action, on X11GNOME Shell only; otherwise PLATFORM_NOT_SUPPORTED
Shell surfacessnapshot --surface system-tray with a StatusNotifierWatcheropen-system-surface for action-center, and for system-tray when a StatusNotifierWatcher is presentquick-settings, taskbar, start-menu, and system-tray-overflow refuse
Systemstatus, permissions, version, batch, skills, session, trace, cursor-overlayWayland: the overlay setting saves with rendered: false

App naming

--app takes the name list-apps prints, such as gnome-calculator, or a desktop-entry name or id backed by a verified executable, such as Files. It never matches a window title.

{ "bundle_id": "org.gnome.Calculator", "name": "gnome-calculator", "pid": 8255, "presentation": "foreground", "process_instance": "6d91df60:28340" }

list-windows --app is an exact, case-insensitive match; list-apps --app also matches a substring. Window ids are opaque strings such as w-1.11-org-gnome-Calculator-a11y-..., valid for the life of the window's process. Several instances of one app share a name; pick one with --window-id. launch accepts an absolute path, a desktop id, a bare command, or a desktop entry name.

Surfaces

supported_surfaces lists window, sheet, alert, and menu, plus GNOME Shell kinds the session can resolve. After an opener, read data.surfaces. A GTK popover appears asynchronously, so if it is absent, run wait --menu before you assume the opener failed. A list-backed GTK4 dropdown is part of the window tree, not a menu surface. A GTK4 list or grid view exposes its items without row nodes, so select and click cannot pick a row. See Surfaces.

Chromium, Qt, and Electron

An app appears in list-apps only when its toolkit registered on the accessibility bus.

AppNeeds
GTK3, GTK4Nothing. An app that started before the bus never registers: restart it
QtQT_ACCESSIBILITY=1 in its environment
Chromium browsers--force-renderer-accessibility; in a bare session without a settings daemon, also --env ACCESSIBILITY_ENABLED=1 on launch
ElectronNo flag. --no-sandbox where chrome-sandbox is not setuid
agent-desktop launch google-chrome --arg=--force-renderer-accessibility

To drive the web contents with agent-browser instead, launch the app with --cdp; see Chromium and Electron apps. GTK apps nest deeply with unnamed group wrappers that -i --compact keeps; read past them, or let a skeleton find the drill targets. Electron native dialogs are not on the AT-SPI tree.

Troubleshooting

SymptomCauseFix
Empty supported_surfaces, or PLATFORM_NOT_SUPPORTED about the AT-SPI busThe session bus or accessibility bus is unreachableRun inside the desktop session; see the four causes above
list-apps or snapshot returns ACTION_NOT_SUPPORTED, "The native window type of accessibility frame owned by pid N could not be proven"No window manager is running, so windows cannot be matched to their X11 clientsRun inside a real desktop session, or start a window manager
The app runs but --app finds nothingThe app is not on the bus, or the name is wrongUse the list-apps name, and see the toolkit table
The window appears but snapshot is thinThe content is not readywait --window, then wait --text, and raise --timeout-ms
ACTION_FAILED, cause frame_not_active, on a scoped pressThe target window is not active and focus changes are not allowedBring the window forward, or pass --headed if focus changes are permitted
ACTION_FAILED, cause blocked_by_modal_dialogA modal dialog or popover blocks the windowRead it with snapshot --surface and answer or dismiss it
ACTION_FAILED, cause grab_focus_rejected, on focusA GTK4 app rejects Component.GrabFocusFocus its window with --headed focus-window
Two quick click calls on one GTK4 button act onceGTK4 reads clicks less than about 250 ms apart as oneWait for the effect between clicks
--menu-closed returns at onceThe menu never openedWait for --menu first
screenshot returns ACTION_FAILED with details.reason: "covered"A non-compositing window manager cannot capture a covered windowRaise it with --headed focus-window; on a non-compositing window manager, capture the display with --screen 0
PERM_DENIED, "private file parent is accessible by group or other users"The state root is not privatechmod 700 the state root

More cases are in agent-desktop skills get linux.