This commit is contained in:
rustdesk
2023-02-09 21:28:42 +08:00
parent 900d0e8be9
commit f7643077d3
12 changed files with 569 additions and 398 deletions

View File

@@ -164,9 +164,6 @@ pub fn core_main() -> Option<Vec<String>> {
#[cfg(feature = "with_rc")]
hbb_common::allow_err!(crate::rc::extract_resources(&args[1]));
return None;
} else if args[0] == "--tray" {
crate::tray::start_tray();
return None;
} else if args[0] == "--portable-service" {
crate::platform::elevate_or_run_as_system(
click_setup,
@@ -183,34 +180,24 @@ pub fn core_main() -> Option<Vec<String>> {
std::fs::remove_file(&args[1]).ok();
return None;
}
} else if args[0] == "--tray" {
crate::tray::start_tray();
return None;
} else if args[0] == "--service" {
log::info!("start --service");
crate::start_os_service();
return None;
} else if args[0] == "--server" {
log::info!("start --server with user {}", crate::username());
#[cfg(target_os = "windows")]
#[cfg(any(target_os = "linux", target_os = "windows"))]
{
crate::start_server(true);
return None;
}
#[cfg(target_os = "macos")]
{
std::thread::spawn(move || crate::start_server(true));
crate::platform::macos::hide_dock();
crate::ui::macos::make_tray();
return None;
}
#[cfg(target_os = "linux")]
{
let handler = std::thread::spawn(move || crate::start_server(true));
// Show the tray in linux only when current user is a normal user
// [Note]
// As for GNOME, the tray cannot be shown in user's status bar.
// As for KDE, the tray can be shown without user's theme.
if !crate::platform::is_root() {
crate::tray::start_tray();
}
crate::tray::start_tray();
// prevent server exit when encountering errors from tray
hbb_common::allow_err!(handler.join());
}
@@ -349,6 +336,6 @@ fn core_main_invoke_new_connection(mut args: std::env::Args) -> Option<Vec<Strin
Some(Vec::new())
} else {
None
}
};
}
}