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): avoid starting Orca on COSMIC (#2666)

Francesco Bonacci069272e0b971
diff --git a/libs/cua-driver/rust/crates/platform-linux/src/a11y.rs b/libs/cua-driver/rust/crates/platform-linux/src/a11y.rs
index 53532de47a..9ebcb7b9f4 100644
--- a/libs/cua-driver/rust/crates/platform-linux/src/a11y.rs
+++ b/libs/cua-driver/rust/crates/platform-linux/src/a11y.rs
@@ -13,10 +13,10 @@
//! embed the same Chromium.
//!
//! A real screen reader turns the Chromium signal on. Doing that ourselves is
-//! unsafe on GNOME: its settings daemon treats the signal as a user request and
-//! launches Orca. GNOME therefore gets only the generic `IsEnabled` signal by
-//! default. Other desktops retain the Chromium signal for compatibility, and a
-//! caller can choose either policy explicitly with
+//! unsafe on GNOME and COSMIC: their session services treat the signal as a user
+//! request and launch Orca. Those desktops therefore get only the generic
+//! `IsEnabled` signal by default. Other desktops retain the Chromium signal for
+//! compatibility, and a caller can choose either policy explicitly with
//! `CUA_DRIVER_RS_A11Y_ADVERTISE_MODE`.
//!
//! Everything here is best-effort. A session without an accessibility bus (some
@@ -153,12 +153,13 @@ fn advertise_mode_from(
}
fn desktop_default_mode(desktop: Option<&str>) -> AdvertiseMode {
- let is_gnome = desktop.is_some_and(|desktop| {
+ let launches_screen_reader = desktop.is_some_and(|desktop| {
desktop
.split([':', ';'])
- .any(|part| part.trim().eq_ignore_ascii_case("gnome"))
+ .map(str::trim)
+ .any(|part| part.eq_ignore_ascii_case("gnome") || part.eq_ignore_ascii_case("cosmic"))
});
- if is_gnome {
+ if launches_screen_reader {
AdvertiseMode::IsEnabledOnly
} else {
AdvertiseMode::All
@@ -183,6 +184,18 @@ mod tests {
);
}
+ #[test]
+ fn cosmic_default_does_not_claim_a_screen_reader() {
+ assert_eq!(
+ advertise_mode_from(false, None, Some("COSMIC")),
+ AdvertiseMode::IsEnabledOnly
+ );
+ assert_eq!(
+ advertise_mode_from(false, None, Some("pop:COSMIC")),
+ AdvertiseMode::IsEnabledOnly
+ );
+ }
+
#[test]
fn non_gnome_default_preserves_chromium_compatibility() {
assert_eq!(