Merge pull request #1871 from 21pages/tray

update tray status
This commit is contained in:
RustDesk 2022-10-30 08:19:18 +08:00 committed by GitHub
commit 6756b67492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -135,6 +135,9 @@ 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(crate::ui_interface::OPTIONS.clone());
return None;
}
}
if args[0] == "--remove" {

View File

@ -27,6 +27,7 @@ pub fn start_tray(options: Arc<Mutex<HashMap<String, String>>>) {
.build()
.unwrap();
let old_state = Arc::new(Mutex::new(0));
let _ = crate::ui_interface::SENDER.lock().unwrap();
event_loop.run(move |event, _, control_flow| {
if options.lock().unwrap().get("ipc-closed").is_some() {
*control_flow = ControlFlow::Exit;
@ -46,7 +47,7 @@ pub fn start_tray(options: Arc<Mutex<HashMap<String, String>>>) {
let mut m = MenuBuilder::new();
if stopped == 2 {
m = m.item(
&crate::client::translate("Start service".to_owned()),
&crate::client::translate("Start Service".to_owned()),
Events::StartService,
);
} else {

View File

@ -89,11 +89,6 @@ pub fn start(args: &mut [String]) {
unsafe {
winapi::um::shellscalingapi::SetProcessDpiAwareness(2);
}
#[cfg(windows)]
if args.len() > 0 && args[0] == "--tray" {
crate::tray::start_tray(crate::ui_interface::OPTIONS.clone());
return;
}
use sciter::SCRIPT_RUNTIME_FEATURES::*;
allow_err!(sciter::set_options(sciter::RuntimeOptions::ScriptFeatures(
ALLOW_FILE_IO as u8 | ALLOW_SOCKET_IO as u8 | ALLOW_EVAL as u8 | ALLOW_SYSINFO as u8