fix(cua-driver/linux): surface native Wayland windows in list_windows on GNOME/KDE (#1978) - #2124
fix(cua-driver/linux): surface native Wayland windows in list_windows on GNOME/KDE (#1978)#2124ai-ag2026 wants to merge 2 commits into
Conversation
… 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>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe Wayland fallback path in ChangesWayland Fallback Enumeration
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…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>
|
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. |
Summary
list_windowsreturned 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_dispatchgates the native-Wayland enumeration onis_wayland(), which requiresDISPLAYunset. GNOME/KDE always run XWayland →DISPLAYset →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 treeget_window_statewalks) into the X11 results:No change on pure-wlroots sessions (the existing
is_wayland()path) or non-opted-in sessions.Validation (Ubuntu 26.04, Mutter, Wayland)
list_windowsreturns onlymutter guard window,GNOME Shell,mutter-x11-frames,ibus-*— no real apps.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