From 1277c7d60c307071333b3ef22fe85cf69008a516 Mon Sep 17 00:00:00 2001 From: Greg Date: Tue, 4 Nov 2025 21:29:37 -0500 Subject: [PATCH] See https://github.com/rustdesk/rustdesk/discussions/13350 (#13427) This adds DBUS_SESSION_BUS_ADDRESS to the collection of "pilfered environment" variables on Linux. The net effect should be that Wayland sub processes launched by rustdesk --service (--server and --tray) get the right bus. Presumably this happens with by systemd environment management, but on Void Linux & other non-systemd, this prevents a connection to a client from any controller with a message about service not available. (As the DBUS lookup fails). On X11, this is not an issue as the retrieval of Wayland capabilities via DBUS registry is not required. In general, this is a more robust Wayland solution than just grabbing WAYLAND_DISPLAY, since WAYLAND is heavily dependent on DBUS for protocol registration. Co-authored-by: Greg Ke --- src/platform/linux.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/platform/linux.rs b/src/platform/linux.rs index ec6210e29..66eefb8a2 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -349,6 +349,9 @@ fn try_start_server_(desktop: Option<&Desktop>) -> ResultType> { if !desktop.home.is_empty() { envs.push(("HOME", desktop.home.clone())); } + if !desktop.dbus.is_empty() { + envs.push(("DBUS_SESSION_BUS_ADDRESS", desktop.dbus.clone())); + } envs.push(( "TERM", get_cur_term(&desktop.uid).unwrap_or_else(|| suggest_best_term()), @@ -1111,6 +1114,7 @@ mod desktop { pub display: String, pub xauth: String, pub home: String, + pub dbus: String, pub is_rustdesk_subprocess: bool, pub wl_display: String, } @@ -1145,6 +1149,7 @@ mod desktop { self.display = get_env("DISPLAY", &self.uid, proc); self.xauth = get_env("XAUTHORITY", &self.uid, proc); self.wl_display = get_env("WAYLAND_DISPLAY", &self.uid, proc); + self.dbus = get_env("DBUS_SESSION_BUS_ADDRESS", &self.uid, proc); if !self.display.is_empty() && !self.xauth.is_empty() { return; }