Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver/linux): report dead input backend on KDE/GNOME Wayland instead of silent no-op (#1982) (#1992)

Francesco Bonacci3aff22663a64
diff --git a/libs/cua-driver/rust/crates/platform-linux/src/health_report.rs b/libs/cua-driver/rust/crates/platform-linux/src/health_report.rs
index 0c44bce561..ca9ea9ff0e 100644
--- a/libs/cua-driver/rust/crates/platform-linux/src/health_report.rs
+++ b/libs/cua-driver/rust/crates/platform-linux/src/health_report.rs
@@ -281,6 +281,29 @@ async fn check_wayland_backend() -> CheckEntry {
format!("All wlroots manager globals advertised ({msg})."),
);
}
+ // Input-injection backend check (#1982). A non-wlroots compositor
+ // (KWin/Plasma, Mutter/GNOME) advertises no zwlr_virtual_pointer; on those
+ // the ONLY working input path is libei via xdg-desktop-portal. If this
+ // binary was built without `portal-libei` (the published tarball is — see
+ // #1967), input injection has no backend and silently no-ops: the agent
+ // cursor renders but clicks/keys are never delivered, while list_windows
+ // and capture still work. Report that explicitly instead of the misleading
+ // "input may fall back" partial-pass below.
+ if !snap.virtual_pointer && !crate::wayland::PORTAL_LIBEI_ENABLED {
+ return CheckEntry::fail(
+ NAME_WAYLAND_BACKEND,
+ format!(
+ "Input injection has no backend on this compositor ({msg}): it \
+ advertises no zwlr_virtual_pointer and this build was compiled \
+ without libei/portal support, so clicks and key presses will not \
+ be delivered (the agent cursor still renders). list_windows and \
+ screen capture are unaffected."
+ ),
+ "Use the portal-enabled Linux build (compiled with --features \
+ portal-libei) for input on KDE Plasma / GNOME, or a wlroots \
+ compositor (sway, labwc, hyprland) where zwlr_virtual_pointer exists.",
+ );
+ }
// Partial-pass: list_windows + capture both work, but virtual-pointer
// input is missing. Require `wl_shm` here too — `check_screen_capture_capability`
// gates on both `screencopy && wl_shm`, so excluding `wl_shm` from the
diff --git a/libs/cua-driver/rust/crates/platform-linux/src/wayland/mod.rs b/libs/cua-driver/rust/crates/platform-linux/src/wayland/mod.rs
index 3c38fbdb9e..a09482e7e9 100644
--- a/libs/cua-driver/rust/crates/platform-linux/src/wayland/mod.rs
+++ b/libs/cua-driver/rust/crates/platform-linux/src/wayland/mod.rs
@@ -26,6 +26,16 @@ pub mod portal_screencast;
#[cfg(feature = "portal-libei")]
pub mod libei;
+/// Whether this binary was compiled with the `portal-libei` feature — the
+/// xdg-desktop-portal RemoteDesktop + libei input path. It is the ONLY input
+/// backend that works on non-wlroots compositors (KWin/Plasma, Mutter/GNOME),
+/// which do not implement `zwlr_virtual_pointer_v1`. The published
+/// curl-pipe-bash tarball is built WITHOUT it (#1967 — debian:11 CD container
+/// lacks a new-enough PipeWire/libei), so on those compositors input injection
+/// has no backend and silently no-ops. Consulted by the doctor and the input
+/// dispatch so that failure is reported instead of hidden. See #1982.
+pub const PORTAL_LIBEI_ENABLED: bool = cfg!(feature = "portal-libei");
+
use std::collections::HashMap;
use wayland_client::{
@@ -786,10 +796,22 @@ pub fn open_vptr_session(activate_window_id: Option<u32>) -> anyhow::Result<Vptr
.seat
.clone()
.ok_or_else(|| anyhow::anyhow!("compositor exposed no wl_seat for virtual-pointer input"))?;
- let mgr = state
- .vptr_manager
- .clone()
- .ok_or_else(|| anyhow::anyhow!("compositor does not expose zwlr_virtual_pointer_manager_v1"))?;
+ let mgr = state.vptr_manager.clone().ok_or_else(|| {
+ if PORTAL_LIBEI_ENABLED {
+ anyhow::anyhow!("compositor does not expose zwlr_virtual_pointer_manager_v1")
+ } else {
+ // KWin/Plasma and Mutter/GNOME don't implement zwlr_virtual_pointer,
+ // and this build has no libei/portal fallback — so input has no
+ // backend at all rather than silently no-op'ing. See #1982.
+ anyhow::anyhow!(
+ "no input backend for this compositor: it exposes no \
+ zwlr_virtual_pointer_manager_v1 and this build was compiled \
+ without libei/portal support (#1982). Use the portal-enabled \
+ Linux build for input on KDE Plasma / GNOME, or a wlroots \
+ compositor (sway, labwc, hyprland)."
+ )
+ }
+ })?;
if let Some(id) = activate_window_id {
let handle = state