Login session: keep the real session bus so the PAM-unlocked GNOME keyring works
As a login session, launched apps were put on a private dbus-daemon bus (meant only to stop single-instance apps forwarding to a host session when nested). That bus has no org.freedesktop.secrets, so apps D-Bus-activated a second, locked gnome-keyring-daemon on it: unlock prompts / "create default keyring" dialogs, even though pam_gnome_keyring had already unlocked the login keyring. The session script also wrapped everything in dbus-run-session whenever DBUS_SESSION_BUS_ADDRESS was unset, splitting off from systemd's user bus. - host-wasm + native sys stub: start the private bus only when nested (WAYLAND_DISPLAY or DISPLAY set); under --drm apps use the session bus. - moon-plasma-session: use $XDG_RUNTIME_DIR/bus when it exists, fall back to re-running itself under dbus-run-session; push WAYLAND_DISPLAY and XDG_* into the D-Bus/systemd activation environment so gcr-prompter can show unlock prompts; run gnome-keyring-daemon --start --components=secrets. - justfile run-drm(-native): update the activation environment too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hhWvZgm7r2v8NpS2g4
This commit is contained in:
4 files changed
+63
-5
No files matched your search
@@ -77,11 +77,22 @@ fn set_nonblock_cloexec(fd: i32) {
|
||||
impl State {
|
||||
/// A private session bus, so single-instance apps (Firefox, Kate, Dolphin...) don't forward
|
||||
/// their launch to an instance on the host session. Dies with this process.
|
||||
///
|
||||
/// Only when nested inside another graphical session (WAYLAND_DISPLAY or DISPLAY set). As a
|
||||
/// login session (--drm from a VT or the display manager) the session bus *is* ours, and it is
|
||||
/// where the PAM-unlocked gnome-keyring (org.freedesktop.secrets), portals and notifications
|
||||
/// live: a private bus would hide them, so apps D-Bus-activate a fresh, locked keyring on it.
|
||||
fn private_bus(&mut self) -> Option<String> {
|
||||
if self.bus_tried {
|
||||
return self.private_bus.clone();
|
||||
}
|
||||
self.bus_tried = true;
|
||||
let nested = ["WAYLAND_DISPLAY", "DISPLAY"]
|
||||
.iter()
|
||||
.any(|v| std::env::var_os(v).map(|x| !x.is_empty()).unwrap_or(false));
|
||||
if !nested {
|
||||
return None;
|
||||
}
|
||||
let mut cmd = Command::new("dbus-daemon");
|
||||
cmd.args(["--session", "--nofork", "--print-address=1"])
|
||||
.stdout(Stdio::piped())
|
||||
|
||||
Reference in new issue
Block a user