Merge pull request #6586 from sahilyeole/feat/wayland_clipboard

Feat: wayland clipboard support
This commit is contained in:
RustDesk
2023-12-01 23:06:02 +08:00
committed by GitHub
3 changed files with 188 additions and 45 deletions

View File

@@ -213,6 +213,9 @@ fn try_start_server_(desktop: Option<&Desktop>) -> ResultType<Option<Child>> {
if !desktop.xauth.is_empty() {
envs.push(("XAUTHORITY", desktop.xauth.clone()));
}
if !desktop.wl_display.is_empty() {
envs.push(("WAYLAND_DISPLAY", desktop.wl_display.clone()));
}
run_as_user(
vec!["--server"],
Some((desktop.uid.clone(), desktop.username.clone())),
@@ -588,10 +591,8 @@ where
let xdg = &format!("XDG_RUNTIME_DIR=/run/user/{}", uid) as &str;
let mut args = vec![xdg, "-u", &username, cmd.to_str().unwrap_or("")];
args.append(&mut arg.clone());
// -E required for opensuse
if is_opensuse() {
// -E is required to preserve env
args.insert(0, "-E");
}
let task = Command::new("sudo").envs(envs).args(args).spawn()?;
Ok(Some(task))
@@ -936,6 +937,7 @@ mod desktop {
pub display: String,
pub xauth: String,
pub is_rustdesk_subprocess: bool,
pub wl_display: String,
}
impl Desktop {
@@ -966,6 +968,7 @@ mod desktop {
for proc in display_proc {
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);
if !self.display.is_empty() && !self.xauth.is_empty() {
break;
}