Bug 493054 - Xwayland startup doesn't include AT-SPI information for Orca to see Xwayland applications
Summary: Xwayland startup doesn't include AT-SPI information for Orca to see Xwayland ...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: xwayland (show other bugs)
Version: 6.1.4
Platform: Fedora RPMs Linux
: HI major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-13 10:29 UTC by Neal Gompa
Modified: 2024-09-27 14:02 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.2.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neal Gompa 2024-09-13 10:29:58 UTC
SUMMARY
In Plasma Wayland, X11 applications seem to be somewhat invisible to Orca. This is because we're missing the required root X properties so that the AT-SPI bus is discovered by X11 applications and connected to.

STEPS TO REPRODUCE
1. Boot up Fedora 41 Beta: https://dl.fedoraproject.org/pub/alt/stage/41_Beta-1.2/Spins/x86_64/iso/Fedora-KDE-Live-x86_64-41_Beta-1.2.iso
2. Launch the installer
3. Activate the screen reader

OBSERVED RESULT
Orca does not start reading the installer

EXPECTED RESULT
Orca reads the installer

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 41 (KDE Plasma)
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
I attempted to work around this with the following startup script, but it didn't work: https://pagure.io/fedora-kde/kde-settings/blob/920a84a80e7999cefef01b1d0b03b3d3ee7e6598/f/etc/xdg/plasma-workspace/env/at-spi-xwayland.sh
Comment 1 Neal Gompa 2024-09-13 20:05:14 UTC
For context, this works in Fedora Workstation because a similar hack is employed through gnome-session launching this script installed in /etc/xdg/Xwayland-session.d.

My Fedora Workstation install has the following in there:

```
ngompa@fedora ~> ls -hal /etc/xdg/Xwayland-session.d/
total 12K
drwxr-xr-x. 1 root root  54 Sep  4 20:18 ./
drwxr-xr-x. 1 root root 276 Jan 24  2024 ../
-rwxr-xr-x. 1 root root 169 Mar 16 01:00 00-at-spi*
-rwxr-xr-x. 1 root root 219 Mar 16 23:14 00-xrdb*
-rwxr-xr-x. 1 root root  38 Aug 14 02:00 10-ibus-x11*

ngompa@Belldandy-LenovoX1CE2 ~> ls -hal /etc/xdg/Xwayland-session.d/
total 12K
drwxr-xr-x. 1 root root  54 Sep  4 20:18 ./
drwxr-xr-x. 1 root root 276 Jan 24  2024 ../
-rwxr-xr-x. 1 root root 169 Mar 16 01:00 00-at-spi*
-rwxr-xr-x. 1 root root 219 Mar 16 23:14 00-xrdb*
-rwxr-xr-x. 1 root root  38 Aug 14 02:00 10-ibus-x11*
ngompa@fedora ~> cat /etc/xdg/Xwayland-session.d/00-at-spi 
#!/usr/bin/sh

xprop -root -format AT_SPI_BUS 8s -set 'AT_SPI_BUS' "$( busctl call --user org.a11y.Bus /org/a11y/bus org.a11y.Bus GetAddress | sed 's/s "\(.*\)"/\1/' )"
ngompa@fedora ~> cat /etc/xdg/Xwayland-session.d/00-xrdb 
#!/usr/bin/sh

userresources=$HOME/.Xresources
sysresources=/etc/X11/Xresources

# merge in defaults
[ -r "$sysresources" ] && xrdb -nocpp -merge "$sysresources"
[ -r "$userresources" ] && xrdb -merge "$userresources"

ngompa@fedora ~> cat /etc/xdg/Xwayland-session.d/10-ibus-x11 
#!/usr/bin/sh
/usr/libexec/ibus-x11 &
```
Comment 2 Bug Janitor Service 2024-09-25 11:10:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6492
Comment 3 David Edmundson 2024-09-25 11:50:29 UTC
Git commit ce8927c93887d63c5b052c1e0f2437e6f3d0b038 by David Edmundson.
Committed on 25/09/2024 at 11:26.
Pushed by davidedmundson into branch 'master'.

xwayland: Run scripts from /etc/xdg/Xwayland-session.d

Some hooks need to run on X11 startup.
On X11 this is handled by the login manager, for XWayland this is the
responsibility of the desktop.

Long term, we want Plasma to make XWayland actually on demand and therefore we
should use the initfd for these startup scripts before the application connects.

M  +5    -0    CMakeLists.txt
M  +2    -0    src/config-kwin.h.cmake
M  +20   -0    src/xwayland/xwayland.cpp
M  +2    -0    src/xwayland/xwayland.h

https://invent.kde.org/plasma/kwin/-/commit/ce8927c93887d63c5b052c1e0f2437e6f3d0b038
Comment 4 David Edmundson 2024-09-27 08:55:59 UTC
Git commit 4bff9354370e3197cc7fe140845f4bf311407e31 by David Edmundson, on behalf of David Edmundson.
Committed on 27/09/2024 at 08:41.
Pushed by davidedmundson into branch 'Plasma/6.2'.

xwayland: Run scripts from /etc/xdg/Xwayland-session.d

Some hooks need to run on X11 startup.
On X11 this is handled by the login manager, for XWayland this is the
responsibility of the desktop.

Long term, we want Plasma to make XWayland actually on demand and therefore we
should use the initfd for these startup scripts before the application connects.


(cherry picked from commit ce8927c93887d63c5b052c1e0f2437e6f3d0b038)

Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>

M  +5    -0    CMakeLists.txt
M  +2    -0    src/config-kwin.h.cmake
M  +20   -0    src/xwayland/xwayland.cpp
M  +2    -0    src/xwayland/xwayland.h

https://invent.kde.org/plasma/kwin/-/commit/4bff9354370e3197cc7fe140845f4bf311407e31