From a06753bbdd4fb8cb2a3e02eaeda9b5aa017ab8c5 Mon Sep 17 00:00:00 2001 From: 21pages Date: Sat, 29 Oct 2022 21:53:18 +0800 Subject: [PATCH 1/2] update tray status Signed-off-by: 21pages --- src/tray.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tray.rs b/src/tray.rs index d29bfc7f2..a71ade329 100644 --- a/src/tray.rs +++ b/src/tray.rs @@ -27,6 +27,7 @@ pub fn start_tray(options: Arc>>) { .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>>) { 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 { From 07f23d8a54450cb1e834faba17a9e0c1f2ecef8a Mon Sep 17 00:00:00 2001 From: 21pages Date: Sat, 29 Oct 2022 21:59:45 +0800 Subject: [PATCH 2/2] flutter deal with --tray Signed-off-by: 21pages --- src/core_main.rs | 3 +++ src/ui.rs | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core_main.rs b/src/core_main.rs index daa97ceb1..8c6430ef8 100644 --- a/src/core_main.rs +++ b/src/core_main.rs @@ -135,6 +135,9 @@ pub fn core_main() -> Option> { #[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" { diff --git a/src/ui.rs b/src/ui.rs index 548bfad43..c25aaf670 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -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