use autostart for --tray in linux because pkexec not work well when start it with --server

This commit is contained in:
rustdesk
2023-06-10 01:55:32 +08:00
parent b14ae250b7
commit 87b32ad8c4
5 changed files with 37 additions and 8 deletions

View File

@@ -1071,17 +1071,17 @@ pub fn check_process(arg: &str, same_uid: bool) -> bool {
.map(|x| x.user_id())
.unwrap_or_default();
for (_, p) in sys.processes().iter() {
if p.pid().to_string() == std::process::id().to_string() {
continue;
}
if same_uid && p.user_id() != my_uid {
continue;
}
if p.cmd().is_empty() || p.cmd()[0] != app {
if p.exe().to_string_lossy() != app {
continue;
}
if arg.is_empty() {
if p.cmd().len() == 1 {
return true;
}
} else if p.cmd().len() > 1 && p.cmd()[1] == arg {
let parg = if p.cmd().len() <= 1 { "" } else { &p.cmd()[1] };
if arg == parg {
return true;
}
}