Skip to content

fix(cua-driver/linux): surface native Wayland windows in list_windows on GNOME/KDE (#1978) - #2124

Closed
ai-ag2026 wants to merge 2 commits into
trycua:mainfrom
ai-ag2026:fix/linux-gnome-list-windows-atspi
Closed

fix(cua-driver/linux): surface native Wayland windows in list_windows on GNOME/KDE (#1978)#2124
ai-ag2026 wants to merge 2 commits into
trycua:mainfrom
ai-ag2026:fix/linux-gnome-list-windows-atspi

Conversation

@ai-ag2026

@ai-ag2026 ai-ag2026 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

list_windows returned no real application windows on GNOME/Mutter (and KDE/KWin) — only XWayland infrastructure. Native Wayland apps were invisible (#1978). This surfaces them via the AT-SPI registry.

Root cause

list_windows_dispatch gates the native-Wayland enumeration on is_wayland(), which requires DISPLAY unset. GNOME/KDE always run XWayland → DISPLAY set → is_wayland() false → it goes straight to X11 enumeration, which only sees XWayland apps. Native Wayland apps have no X11 XID, so they never appear.

Change

On an opted-in Wayland session (CUA_DRIVER_RS_ENABLE_WAYLAND=1 + WAYLAND_DISPLAY), merge the AT-SPI registry (keyed by pid — the same tree get_window_state walks) into the X11 results:

  • X11 entries keep priority (real XID + geometry).
  • AT-SPI adds windows for pids X11 didn't report (native Wayland apps that expose accessibility).

No change on pure-wlroots sessions (the existing is_wayland() path) or non-opted-in sessions.

Validation (Ubuntu 26.04, Mutter, Wayland)

  • Before: list_windows returns only mutter guard window, GNOME Shell, mutter-x11-frames, ibus-* — no real apps.
  • After: a native gnome-text-editor (no X11 XID) appears with its pid + title (New Document (Draft) - Text Editor), alongside the XWayland windows.

Limitations

Only apps that expose an AT-SPI accessibility tree are enumerable this way (the same constraint as get_window_state). AT-SPI windows carry a stable synthetic xid + pid but no geometry (x/y/size are 0), consistent with the existing AT-SPI fallback used on wlroots. Full native-Wayland geometry needs a compositor-side helper (out of scope).

Refs

Part of the #1922 native-Wayland follow-ups. Complements #2112 (input) — you can now both enumerate and drive native Wayland apps on GNOME/KDE.

Summary by CodeRabbit

  • Bug Fixes
    • Improved window listing on Wayland by combining information from multiple sources when available.
    • Reduced missing or duplicate windows in mixed Wayland/X11 sessions by merging results more intelligently.

… on GNOME/KDE (trycua#1978)

On GNOME/Mutter and KDE/KWin the session always runs XWayland, so DISPLAY is
set and is_wayland() is false — list_windows_dispatch went straight to X11
enumeration, which only sees XWayland apps. Native Wayland apps have no X11
XID, so they were invisible (list_windows returned only XWayland
infrastructure windows like "mutter guard window" / "GNOME Shell").

Merge the AT-SPI registry (keyed by pid, the same tree get_window_state walks)
into the X11 results on an opted-in Wayland session, so native Wayland apps
that expose accessibility show up too. XWayland apps appear in both lists; the
X11 entry (real XID + geometry) wins, and only AT-SPI windows for pids X11
didn't report are added.

Verified on Ubuntu 26.04 GNOME/Wayland: a native gnome-text-editor (no X11
XID) now appears in list_windows with its pid + title; previously only
mutter/XWayland internal windows were listed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8ebd8ee9-96dd-410d-a1a8-5601ae9a369a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The Wayland fallback path in list_windows_dispatch now merges window lists from X11 enumeration and the AT-SPI registry instead of returning X11 results alone. It always collects X11 windows, then conditionally appends AT-SPI windows whose pids weren't already present, when native Wayland is enabled and WAYLAND_DISPLAY is set.

Changes

Wayland Fallback Enumeration

Layer / File(s) Summary
Merge AT-SPI windows into X11 fallback list
libs/cua-driver/rust/crates/platform-linux/src/wayland/mod.rs
list_windows_dispatch's Wayland last-resort path now starts with X11 list_windows, then conditionally merges AT-SPI windows for pids not already reported by X11 when wayland_enabled() is true and WAYLAND_DISPLAY is set.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • trycua/cua#1998: Modifies AT-SPI tree walking retry behavior, directly affecting the AT-SPI-derived windows this fallback now enumerates.

Poem

A rabbit peeks through Wayland's veil,
X11's list, then AT-SPI's trail,
Pids unseen now hop right in,
No window left behind again!
🐇✨🪟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: surfacing native Wayland windows in Linux list_windows on GNOME/KDE.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…veats

Self-review follow-ups on the list_windows AT-SPI merge:

- When a specific `filter_pid` was already resolved via X11, skip the AT-SPI
  registry walk entirely (it's a full per-app D-Bus enumeration that can only
  add duplicates for that pid).
- Document that merged AT-SPI entries carry a synthetic xid + zero geometry
  (so bring_to_front/screenshot_window/pixel-translation against them error
  cleanly), and that dedup is per-pid (an app owning both an XWayland and a
  separate native-Wayland toplevel lists only the XWayland one).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ai-ag2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded: the Linux convergence landing (#2182, commit 51a8e25) incorporated this fix verbatim — merge_atspi_windows, the already-covered skip of the redundant AT-SPI walk, and the documented merge caveats all ship on main as a strict superset (plus the ext_toplevel fallback and native-window enrichment beyond this branch). A rebase leaves an empty diff, so there is nothing left to merge. Thanks for folding the fix into the convergence series.

@ai-ag2026 ai-ag2026 closed this Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant