fix: accessibility tree in isolated sessions on Fedora#8
Open
davidselassie wants to merge 1 commit intoisac322:mainfrom
Open
fix: accessibility tree in isolated sessions on Fedora#8davidselassie wants to merge 1 commit intoisac322:mainfrom
davidselassie wants to merge 1 commit intoisac322:mainfrom
Conversation
## Summary
- Fix `accessibility_tree` (and all AT-SPI tools) returning empty results
or crashing in isolated virtual sessions on Fedora
- Extract AT-SPI binary paths from D-Bus service files instead of
hardcoding distro-specific paths
- Explicitly bootstrap the AT-SPI registryd in isolated sessions where
no session manager is present to auto-activate it
## What broke
Two problems prevented the accessibility tree from working in isolated
virtual sessions on Fedora (and potentially other distros):
1. **Wrong binary path**: `at-spi-bus-launcher` was hardcoded to
`/usr/lib/at-spi-bus-launcher`, but Fedora installs it at
`/usr/libexec/at-spi-bus-launcher`. The launcher silently failed to
start, so the AT-SPI bus was never created. AT-SPI queries crashed
with "Couldn't connect to accessibility bus".
2. **Missing registryd**: Even with the bus launcher running, the
`at-spi2-registryd` daemon was never started. D-Bus auto-activation
fails because the `.service` file uses `--use-gnome-session`, which
requires a GNOME session manager that doesn't exist in isolated
sessions. Without the registryd, no applications register their
accessibility trees, so `accessibility_tree` returned "(no accessible
applications found)".
## How it's fixed
- Binary paths for both `at-spi-bus-launcher` and `at-spi2-registryd`
are now extracted from their D-Bus service files
(`/usr/share/dbus-1/services/org.a11y.Bus.service` and
`/usr/share/dbus-1/accessibility-services/org.a11y.atspi.Registry.service`).
These file locations are standardized by the D-Bus spec, so this works
on any distro without hardcoding paths.
- The wrapper script now explicitly sets `IsEnabled=true` on the AT-SPI
bus and starts `at-spi2-registryd` without `--use-gnome-session`,
ensuring apps register their accessibility trees.
- Process cleanup is unchanged: `session.stop()` kills the entire
process group via `os.killpg()`, which covers the registryd.
## How to test
Verify path extraction resolves to a real binary on your system:
sed -n 's/^Exec=\([^ ]*\).*/\1/p' /usr/share/dbus-1/services/org.a11y.Bus.service
Smoke test — should print an accessibility tree with elements, not
"(no accessible applications found)":
printf 'session_start app_command=kcalc\naccessibility_tree\nsession_stop\nquit\n' \
| uv run kwin-mcp-cli
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
325712d to
84e4217
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
accessibility_tree(and all AT-SPI tools) returning empty results or crashing in isolated virtual sessions on Fedora. Extract AT-SPI binary paths from D-Bus service files instead of hardcoding distro-specific paths, and explicitly bootstrapat-spi2-registrydin isolated sessions where no session manager is present to auto-activate it.Motivation
Wrong binary path:
at-spi-bus-launcherwas hardcoded to/usr/lib/at-spi-bus-launcher, but Fedora installs it at/usr/libexec/at-spi-bus-launcher. The launcher silently failed to start, so the AT-SPI bus was never created. AT-SPI queries crashed with "Couldn't connect to accessibility bus".Fix: Extract the binary path from the D-Bus service file (
/usr/share/dbus-1/services/org.a11y.Bus.service) usingsed. This is more robust than hardcoding paths for each distro because the service file location is standardized by the D-Bus spec and always contains the correctExec=path for the current system — whether that's/usr/libexec(Fedora),/usr/lib(Arch),/usr/lib/at-spi2-core(Debian), or anything else. D-Bus auto-activation was also considered but doesn't work fromdbus-run-session(fails with "Permission denied").Missing registryd: Even with the bus launcher running,
at-spi2-registrydwas never started. D-Bus auto-activation fails because the.servicefile uses--use-gnome-session, which requires a session manager that doesn't exist in isolated sessions. Without the registryd, no applications register their accessibility trees, soaccessibility_treereturned "(no accessible applications found)".Fix: Extract the registryd binary path from its service file (
/usr/share/dbus-1/accessibility-services/org.a11y.atspi.Registry.service) the same way, then start it directly without--use-gnome-session. The wrapper script also setsIsEnabled=trueon the AT-SPI bus so that apps know to register their accessibility trees. No explicit cleanup is needed —session.stop()already kills the entire process group viaos.killpg(), which covers the registryd.How to Test
Checklist
uv run ruff check .passesuv run ruff format --check .passesuv run ty checkpasses🤖 Generated with Claude Code