feat(agent): attach to active X11 session for the desktop tab (VA-86) #93
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VA-86-x11-session-attach"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Extends the root system service's active-session discovery (VA-84) to also drive an X11 session, completing the desktop tab's X11 support. Builds on VA-84, which is merged to main (PR #89).
Why this is small
The X11-vs-Wayland selection in the KVM crate is already environment-driven:
vervain_agent_kvm::wayland::is_wayland_session()keys offWAYLAND_DISPLAY/XDG_SESSION_TYPE, and the X11 capture (x11rb::connect(None)) and XTEST input both readDISPLAY/XAUTHORITYfrom the environment. VA-84 already discovers the active seat0 session and exports the Wayland addressing. So the only missing piece for X11 is resolving and exportingDISPLAY/XAUTHORITY. The change is therefore confined tocrates/vervain-agent/src/active_session.rs.Changes
parse_session_propsnow reads logind'sDisplay=andLeader=properties;discoverrequests them fromloginctl show-session.discoverresolvesDISPLAYandXAUTHORITYandexport_envexports them. An X11 attach setsXDG_SESSION_TYPE=x11and leavesWAYLAND_DISPLAYunset, sois_wayland_session()returns false and the existing X11 capture + XTEST path is selected automatically (AC2). Wayland sessions are unchanged.resolve_x11):DISPLAYfrom logind'sDisplayproperty, falling back to the session leader's/proc/<pid>/environ;XAUTHORITYfrom the leader's environ, falling back to the owning user's~/.Xauthority(home resolved from/etc/passwd, file existence checked). As root all of these are readable on disk.XAUTHORITYresolves,DISPLAYis still exported and the desktop tab returns the existingNotAvailablestatus rather than crashing.environ_lookup,parse_passwd_home,resolve_x11plus thin I/O wrappersread_proc_environ,home_for_uid. Module docs,attach_and_log, and the README desktop-tab line updated.Acceptance criteria
resolve_x11and session-type unit tests).just checkand the Docker build pass.Tests / checks
active_sessionmodule), all green.just check(fmt, clippy--deny warnings, test) passes.oci-build/check.Dockerfilebuild passes locally, including the Windows cross-check and the swtpm TPM test (also runs the pre-commit hook on commit).