Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Cua Hyprland plugin
This directory is the source of truth for an optional, experimental Hyprland plugin. The plugin is disabled by default and is not part of the portable Cua Driver installation. It must be built for the exact Hyprland version that will load it; a plugin built against another Hyprland ABI must fail closed rather than attempt to run. Load checks compare Hyprland's full client/server ABI fingerprint, including the compositor commit and linked Hyprland library versions, before calling other compositor APIs. The package and validation record must also match the compiler toolchain because Hyprland passes C++ objects across the plugin API.
The module must dynamically link the C++ runtime used by the compositor. The build checks its ELF dependencies and rejects a static C++ runtime; a compiler copied without its runtime libraries can otherwise silently select a static archive. Do not load a module from a failed build.
The default build is discovery-only. It advertises protocol status and
liveness, but rejects input mutation with the typed background_unavailable
result. Here, discovery means negotiation, status, and liveness, not
application target discovery or input delivery.
This branch adds an opt-in input v3 candidate using
Driver's existing per-action permission checks and two independent compositor
seats. It does not require a signer or an Omarchy-specific approval panel.
The candidate remains experimental and unreleased. A source version of
0.23.2 does not mean released Driver 0.23.2 contains these changes.
PR #3572 records dated, exact-source
validation results. Acceptance requires the unchanged complete Linux canonical
runner on native Hyprland and separate bounded qualified-app proof. See the
shared admission boundary and
production proof preparation for the native
testing, packaging, and release requirements.
Bounded instrumented app proof and an uninstrumented smoke are retained from
source f180e8828b8f31cc153e3c44eaa89a9c13c5bc68, with an unchanged plugin
tree and uninstrumented module hash at
1133a06e4f205cf80188a7ac9e41102f37611fea. The proof covers the recorded
actions and observation intervals. Background input now admits any native
Wayland window whose app bound the agent seats Cua-Agent and Cua-Agent-2
(GTK 3 and 4 and Qt 6 do; Qt 6 keys refuse), with the plain compiled
evdev/pc105/us keymap. Chromium and Electron bind only the user's seat and
refuse with client_not_bound; XWayland refuses. Semantic AT-SPI actions are
separate.
The exact-target foreground route intentionally changes primary focus and, for pointer actions, cursor position, without restoration. The canonical native harness covers defined GTK3, Electron, and Tauri foreground cases. A background refusal never authorizes a hidden foreground fallback.
This branch also contains a separate, opt-in isolated-input compatibility experiment. It is not enabled by the normal build or package. Its test-only operator boundary and resident-module unload workaround are not a production contract. See the input experiment validation for the exact single-seat artifacts and the concurrent real-app validation for two-lane Calc/Inkscape evidence, event-level primary-cursor measurement, and Cancel/Stop results. Those historical candidates needed app restarts after plugin reload. The candidate keeps seats across config toggles and requires a desktop restart for plugin replacement; that lifecycle requires native acceptance evidence. This experiment does not establish production hot-reload support.
The desktop-state safety record covers matched fault-only controls and background drags during target movement, resizing, destruction, real session lock, and display-off. It documents the tested artifacts and remaining gates, not production certification.
This design builds on Dillon DuPont's Hyprland injection prototype. That credit records the prototype lineage; it does not claim that the prototype or input mutation support has shipped in Cua Driver.
Build
Install the Hyprland headers for the exact installed compositor version, plus CMake 3.30 or newer, Ninja, and the same compiler family and version used to build Hyprland. The plugin and its libraries use Hyprland's C++26 language mode. From this directory:
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
To compile the production-protocol candidate in a disposable test environment,
add -DCUA_HYPRLAND_INPUT=ON. This is separate from
CUA_HYPRLAND_TEST_INPUT; selecting both refuses. Detailed event measurement
also requires -DCUA_HYPRLAND_INPUT_TRACE=ON. Do not ship that instrumentation
in the production package. Neither build option loads or enables the plugin.
For a pinned acceptance build, also set
-DCUA_HYPRLAND_EXPECTED_VERSION=0.56.2 (or the exact intended pkg-config
version). The build refuses a different header version. The status-command
adapter supports both Hyprland 0.56.2's SHyprCtlCommand API and the newer
Socket1 API. CMake compile-checks the installed PluginAPI.hpp and selects a
declared tier; an unknown command API fails configuration. Input builds
likewise compile-check the window and layer-surface internals they read
(the 0.57 window-backend API or the earlier one) instead of pinning a Hyprland
version, and unknown internals fail configuration. The nightly requalification
below proves each new Hyprland build with a headless load and input smoke. The probes use
C++26 and repeat on reconfiguration so a header upgrade cannot reuse a cached
tier. Both adapter paths run in the local mock suite. A separate configuration
test checks tier selection, compiler flags, and unsupported headers. Real-header
and live-load evidence remain required on Linux.
On a non-Linux review host, build only the portable protocol, transport shim, and mocked plugin-API tests:
cmake -S . -B build -DCUA_HYPRLAND_BUILD_PLUGIN=OFF -DBUILD_TESTING=ON
cmake --build build
ctest --test-dir build --output-on-failure
That workflow is not Linux or Hyprland evidence. Release validation must use
the production SOCK_SEQPACKET/SO_PEERCRED path and real matching Hyprland
headers.
Do not retain or redistribute the resulting module across a Hyprland upgrade.
Rebuild it against the upgraded Hyprland package instead. The local Arch recipe
in packaging/arch/ installs a version-pinned development package without
changing Hyprland configuration.
Requalification for each Hyprland build
nightly-hyprland-plugin-requalify.yml
runs daily and can also be dispatched by hand. It detects new Hyprland builds
in Arch and in the Omarchy edge, rc and stable channels, keyed by package
version and package hash. For each new build it rebuilds this plugin against
the exact headers in an Arch container, runs CTest, records the header hashes,
and loads the module into a headless Hyprland for a window-targeted input
smoke. The results go to the hyprland-plugin-compat branch as
compatibility.json. See requalify/COMPAT-BRANCH.md.
This is CI evidence. It is not a kit or native certification.
Load, inspect, and unload
Loading is always an explicit operator action. For a local build, substitute the actual module path emitted by CMake:
hyprctl plugin load "$PWD/build/cua-hyprland-plugin.so"
hyprctl -j cua:status
hyprctl plugin unload "$PWD/build/cua-hyprland-plugin.so"
For the Arch development package, use:
hyprctl plugin load /usr/lib/cua/hyprland/cua-hyprland-plugin.so
hyprctl -j cua:status
hyprctl plugin unload /usr/lib/cua/hyprland/cua-hyprland-plugin.so
Do not add a plugin = line to Hyprland configuration until the ABI match and
status output have been checked in a disposable session. A mismatched module
may be refused by Hyprland or fail during load. If load fails after a Hyprland
upgrade, leave it unloaded, rebuild against the new exact package, and retry.
The portable driver remains available without this plugin.
hyprctl -j cua:status is the authoritative runtime status surface. Consumers
must check its compositor epoch, protocol version, advertised capabilities,
socket path, discovery-only state, and ABI identity before connecting. A loaded
module alone is not evidence that target discovery or mutation is available.
The opt-in v3 build also reports two keyboard fields, whether or not input is enabled, so an installer can tell an updated module from an older one still loaded in the running compositor before it enables input:
keyboard_layout_independent: true: the agent seats use their own canonical keymap, and foreground pointer-only actions do not depend on the physical keyboard layout.foreground_numlock_compatible: true: foreground keyboard actions keep the human keyboard's Num Lock and admit a key only when it means the same thing under it. Caps Lock, and keypad keys that Num Lock changes, refuse explicitly.
Neither field says that the current physical keymap qualifies for foreground typing; each foreground key is still checked when it is sent.
The local transport is also disabled by default. To exercise negotiation in a disposable session, set the following and reload the configuration after the plugin loads. For Omarchy's Lua configuration, add:
hl.config({plugin = {cua = {enabled = true}}})
For a legacy Hyprland configuration, use:
plugin:cua:enabled = true
Run hyprctl reload after editing the configuration. The plugin reconciles
transport state on config reload; a runtime hyprctl eval or keyword alone
does not start or stop it. To disable the transport, remove the setting or set
it to false in the configuration and reload. Unloading the plugin also closes
the socket and every connection immediately.
For the default discovery build, this enables status and liveness only. For the opt-in v3 build, it also opens the two input endpoints. Enabling v3 is a trusted-local desktop configuration choice; Driver still checks each call under its normal permission policy. The candidate refuses clients, layouts, and operations outside its qualification scope.
Security boundary
- The socket lives at
$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/cua-inject-v2.sockfor the current Hyprland instance, not in a global temporary directory, and is created with mode0600. - The server verifies
SO_PEERCREDand accepts only peers with the compositor user's UID. This authenticates only the local Unix user, not a particular Cua process. Filesystem permissions are defense in depth, not authorization. - The default foundation remains mutation-free. The separate v3 candidate uses normal Driver policy plus per-action compositor target binding. It does not sandbox arbitrary native code running as the desktop user. An app compatibility list, socket permissions, or cursor indicator is not such a sandbox.
- The transport is bounded, nonblocking Unix
SOCK_SEQPACKET; oversized, truncated, malformed, or unsupported packets are rejected without mutation. - A client must complete
HELLOwithin five seconds. A negotiated client must send traffic such asPINGat least once per minute or the plugin closes the idle connection; long-lived driver processes must reconnect and renegotiate. - Future target handles must be opaque tokens scoped to one compositor epoch. Clients must discard them when the epoch changes and must not infer window identity from token contents. The discovery-only build issues no target handles.
- Protocol capabilities are negotiated explicitly. Absence of a capability is a refusal, never permission to try a weaker route.
- The plugin never redirects a target-addressed request to the primary seat, focused window, pointer location, or another target.
- Two client requests take the user's whole seat in Hyprland 0.56 and 0.57,
whatever seat and serial they name: a popup grab (a menu, a combo-box list)
moves the user's keyboard to the popup until it closes, and a drag start makes
the drag follow the user's pointer and drop on their next click. A background
app can make either request when an agent seat or an accessibility action
works in it. Input builds hook both (
src/user_seat_guard.cpp) and grant them only to the client that holds the user's keyboard or pointer focus, as every popup and drag the user starts does. Other popups open without the grab; other drags are cancelled.cua:statusreportsuser_seat_guard,popup_grabs_withheldanddrags_withheld. - A transport acknowledgement proves only receipt and validation. Application behavior requires a separate typed result and independent state evidence.
The wire contract is documented in protocol/cua-inject-v2.md.
Relationship to current Hyprland support
Existing Cua Driver paths for capture, target identity, foreground input, and AT-SPI semantic actions are separate from this plugin. A semantic action can sometimes update a background application's accessibility object without raw pointer or keyboard synthesis; that does not prove isolated synthetic input.
Validate stock Cua Driver 0.23.2 desktop capture, window enumeration,
foreground actions, and AT-SPI actions separately. Available protocols and
accessibility services establish prerequisites; successful actions require
application-state evidence. The host Hyprland/plugin ABI pair, plugin transport,
opaque target binding, and isolated raw background input each require their
own acceptance evidence on the exact host and candidate module.
The input candidate resolves display-scoped manifest resources through a content-free Hyprland IPC geometry query, with the existing same-compositor peer check. This path requires one unscaled, unrotated output at the origin. It does not use a screenshot or an XWayland root as display identity, and it does not relax the manifest. Other layouts refuse this metadata query; native display metadata on other Wayland compositors remains a separate limitation. This source change is not evidence that the capability has been released.
Compositor administration also remains explicit. Integrations may invoke
hyprctl for an operator-requested workspace, monitor, window-rule, focus, or
DPMS operation, but a Cua background action must never hide a target-delivery
failure by changing compositor state. DPMS-on is a precondition for visual
delivery evidence; an all-black frame while DPMS is off is not success.
hyprctl is the compositor administration and plugin status boundary. The
plugin adds hyprctl -j cua:status, but it does not turn arbitrary hyprctl
commands into application-targeted input or application-delivery proof. Tests
must observe whether the stock foreground route explicitly activated a window
and must keep that behavior separate from the opt-in plugin routes. Mutation
remains disabled in the default discovery-only build.
Application enumeration and call authorization also stay in Cua Driver.
Filtering list_apps, choosing a one-shot cua-driver call versus a long-lived
cua-driver serve process, and enforcing per-call capability or policy rules
are not plugin capabilities. The plugin authenticates and negotiates its local
protocol; it does not replace the driver's tool policy or process lifecycle.
Acceptance path
The release path requires focused protocol and security tests, the repository's complete native Linux harness, bounded qualified-app compatibility and isolation evidence, review and merge, compatible release artifacts, and image packaging and lifecycle validation. Source-built proof does not establish that the released package or final image works.
Physical-host support requires a separate acceptance run on the exact Hyprland/plugin pair, with focus, z-order, cursor, input-isolation, and fixture-state evidence. VM evidence does not establish physical-host parity; that separate support claim is not a prerequisite for publishing a validated VM image.
The exact initial host acceptance baseline is:
| Component | Required baseline |
|---|---|
| Omarchy | 4.0.2-1 |
| Hyprland | 0.56.2 |
| xdg-desktop-portal-hyprland | 1.4.1 |
| Cua Driver | 0.23.2 |
| Session and display manager | UWSM / SDDM |
This baseline is an acceptance target, not a statement that the reported host
or its Hyprland/plugin ABI pair has passed validation. It is also not a claim
that isolated background input ships in stable 0.23.2 or nightly. The plugin
remains discovery-only in its normal build. The separate physical run has explicit foreground
activation observation, GTK3, GTK4, Qt6, LibreOffice, Chromium/Ozone, Electron,
DPMS-off refusal, and one-shot and long-lived graphical-session client rows;
see tests/README.md for the required evidence. Those broader application rows
are separate from the per-target background admission, plain US keymap, and
two seats documented in the input v3 contract.