diff --git a/src/platform/linux.rs b/src/platform/linux.rs index b3fde7808..33ebcc82c 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -226,11 +226,11 @@ fn stop_rustdesk_servers() { } #[inline] -fn stop_xorg_subprocess() { +fn stop_subprocess() { let _ = run_cmds(&format!( r##"ps -ef | grep '/etc/rustdesk/xorg.conf' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##, )); - let _ = run_cmds(format!( + let _ = run_cmds(&format!( r##"ps -ef | grep -E 'rustdesk +--cm-no-ui' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##, )); } @@ -797,16 +797,6 @@ mod desktop { super::is_gdm_user(&self.username) && self.protocal == DISPLAY_SERVER_WAYLAND } - #[inline] - pub fn is_headless(&self) -> bool { - self.sid.is_empty() - } - - #[inline] - pub fn is_login_wayland(&self) -> bool { - super::is_gdm_user(&self.username) && self.protocal == DISPLAY_SERVER_WAYLAND - } - #[inline] pub fn is_headless(&self) -> bool { self.sid.is_empty() || self.is_rustdesk_subprocess diff --git a/src/platform/linux_desktop_manager.rs b/src/platform/linux_desktop_manager.rs index c70724a5e..3a72f8976 100644 --- a/src/platform/linux_desktop_manager.rs +++ b/src/platform/linux_desktop_manager.rs @@ -373,7 +373,7 @@ impl DesktopManager { fn wait_x_server_running(pid: u32, display_num: u32, max_wait_secs: u64) -> ResultType<()> { let wait_begin = Instant::now(); loop { - if run_cmds(format!("ls /proc/{}", pid))?.is_empty() { + if run_cmds(&format!("ls /proc/{}", pid))?.is_empty() { bail!("X server exit"); } diff --git a/src/server/connection.rs b/src/server/connection.rs index 8a8714c6f..65a3fd025 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -915,7 +915,7 @@ impl Connection { } #[cfg(target_os = "linux")] if !self.file_transfer.is_some() && !self.port_forward_socket.is_some() { - let (_, dtype) = crate::platform::linux::get_user_and_display_server(); + let dtype = crate::platform::linux::get_display_server(); if dtype != crate::platform::linux::DISPLAY_SERVER_X11 && dtype != crate::platform::linux::DISPLAY_SERVER_WAYLAND { @@ -2222,7 +2222,7 @@ async fn start_ipc( username = linux_desktop_manager::get_username(); } let uid = { - let output = run_cmds(format!("id -u {}", &username))?; + let output = run_cmds(&format!("id -u {}", &username))?; let output = output.trim(); if output.is_empty() || !output.parse::().is_ok() { bail!("Invalid username {}", &username); diff --git a/src/ui_interface.rs b/src/ui_interface.rs index 1181598a6..fa73490ad 100644 --- a/src/ui_interface.rs +++ b/src/ui_interface.rs @@ -511,9 +511,8 @@ pub fn get_error() -> String { #[cfg(not(any(feature = "cli")))] #[cfg(target_os = "linux")] { - let (username, dtype) = crate::platform::linux::get_user_and_display_server(); + let dtype = crate::platform::linux::get_display_server(); if crate::platform::linux::DISPLAY_SERVER_WAYLAND == dtype - && !crate::platform::linux::is_gdm_user(&username) { return crate::server::wayland::common_get_error(); }