linux, refact desktop env

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-03-28 20:20:45 +08:00
parent 461aa622f8
commit 5e79481860
6 changed files with 163 additions and 293 deletions

View File

@@ -356,40 +356,6 @@ pub fn check_zombie() {
});
}
#[cfg(target_os = "linux")]
pub fn check_xdesktop() {
std::thread::spawn(|| {
use crate::platform::linux_desktop::{get_desktop_env, DesktopEnv};
let mut desktop_env = DesktopEnv::new();
loop {
let new_env = match get_desktop_env() {
Some(env) => env,
None => DesktopEnv::new(),
};
if new_env.is_ready() {
if !desktop_env.is_ready() {
desktop_env = new_env.clone();
} else {
if !desktop_env.is_same_env(&new_env) {
log::info!("xdesktop env diff {:?} to {:?}", &new_env, desktop_env);
break;
}
}
} else {
if desktop_env.is_ready() {
log::info!("xdesktop env diff {:?} to {:?}", &new_env, desktop_env);
break;
}
}
std::thread::sleep(Duration::from_millis(300));
}
crate::RendezvousMediator::restart();
});
}
/// Start the host server that allows the remote peer to control the current machine.
///
/// # Arguments