Skip to content
Draft, pre-release documentation

Native applications such as LibreOffice, GIMP or a file manager have no page to read. The runtime reads their controls through the accessibility bus (AT-SPI), lists them with handles, and acts on a control by its handle. That reaches a button by its name and reports what happened. No model is involved.

apps.list returns the workspace’s applications, running or not: the name that apps.start takes, a description, the URL schemes it handles, and how each can be driven once it runs (drive: cdp, accessibility, screen). A running application also lists its windows, its accessibility scopes and the names dom.targets shows for it. Listing starts nothing. Desktop settings panels that are not running are counted in hidden; include: "all" lists them.

apps.start runs the application’s own launcher, with url in the place the launcher leaves for one. The launcher supplies the desktop and debugging settings the runtime relies on, so launch and proc.spawn refuse a command whose program is an installed application’s own and name the apps.start call to use. Starting an application that already runs hands over to the running instance, and the result says reused: true. A result with state: "starting" is not a failure; call apps.list or dom.targets again.

Name exactly one thing to read. There is no default application and none is guessed from focus.

Reference Looks like From
application app_... apps.list, windows.list
window w_... windows.list
scope s_... apps.list, windows.list, an earlier listing

apps.list and windows.list also accept the application’s name. A window’s scope, its accessibility frame, is known only after windows.activate has raised it.

a11y.list returns the controls of what you named, read fresh. Each has a handle (a_...), role, name, states, available actions, and its text or value. filter narrows by name and max_nodes bounds the read. a11y.tree returns the same read grouped by window, dialog and open menu. a11y.read_text reads a bounded prefix of one field’s text beyond the listing’s preview.

A dialog another program shows for the application, such as the desktop’s file chooser, is linked under dialogs and never mixed into the application’s controls. Read it by its scope.

A handle names one object. When the control closes, its application restarts or the accessibility service restarts, the handle stops working with the reason, and the runtime never gives it to something else. References do not carry over to a new session.

Mutations take element and nothing else.

Method Does
a11y.action Invokes the control’s default action, or the action you name
a11y.set_text Replaces a field’s whole text
a11y.set_value Sets a slider or spin button within its range
a11y.select Selects a list, tree, tab or combo-box item

Each reads the result back. outcome is performed, or outcome_unknown when the application never answered, in which case check with a11y.list before repeating. verification is held, failed or unreadable. A failed check does not mean the action did not run: it ran, so do not retry a toggle. expect_state checks a state of the control after a11y.action.

The action goes through the application’s own accessibility support, with no coordinate involved and no need for the window to be in front. A control with no action of its own is clicked at its reported position only when you pass allow_pointer: true and its window has been raised with windows.activate.

A dom.* handle (e_...) passed to an a11y.* method is refused before anything is sent, and the reverse.

a11y.wait waits for a dialog, menu or control to appear (appear: {role, name}), or for a control to reach a state. It finds something already showing at once, and a timeout is a normal result with timed_out: true. windows.wait waits from a cursor, so a window that opened between your action and the wait still matches:

  1. windows.list returns a cursor.
  2. Act.
  3. windows.wait with since set to the cursor and appear (or gone) returns the window.
Method Does
windows.list Lists top-level windows with their window reference, owner, type, geometry and whether a modal dialog blocks them
windows.activate Raises and focuses a window and reads back which window is active. It does not route input; keys go to whatever has focus
windows.close Asks a window to close and never kills it. pending means it is still there, usually asking to save
windows.move_resize Moves or resizes and returns the geometry the window manager allowed

Neither the accessibility service nor the browser stops an action behind a modal dialog, so the runtime does. While a modal dialog is up for an application, a11y.* and dom.* calls that would change that application fail as not_performed: blocked by a modal dialog, name the dialog in blocked_by, and send nothing. Reads, and actions inside the dialog, still work. apps.list shows each application’s blocked_by before you act. input.* is never blocked.

When an action opens a menu or a dialog, ask the runtime to watch for it. Pass handoff: {kind: "menu"} or {kind: "dialog"} (and timeout_s, default 5, at most 30) to a11y.action, dom.click or dom.key. The runtime starts watching before it sends the action. The result’s data.handoff gives a status:

Status Meaning
ready One menu or dialog appeared and is confirmed to belong to the application. Its scope is in surfaces
ambiguous Several appeared, or only ones nothing confirms. All are listed and none is picked for you
pending Nothing appeared in time
closed What appeared has gone

apps.handoff looks again with the token the call returned, for 60 seconds. A handoff holds the desktop while it watches, so keep timeout_s short.

A round trip from a web application’s page to its native menu and file chooser, with handles illustrative:

apps.list() -> the application, its page, its scopes
a11y.list(application="app_1", filter="File") -> the File menu's handle a_1
a11y.action(element="a_1", handoff={kind:"menu"}) -> ready: the menu's scope s_2
a11y.list(scope="s_2") -> the menu command's handle a_2
a11y.action(element="a_2", handoff={kind:"dialog"}) -> ready: the chooser's window and scope s_3
a11y.list(scope="s_3", filter="Cancel") -> the Cancel button's handle a_3
a11y.action(element="a_3") -> performed

The file chooser belongs to another program, and its for_application names the application only because it belongs to that application’s window. When a handoff is ambiguous, inspect each surface and choose; do not take the newest or the focused one.