From 3389c798f64c08e3a61d0ff17841ea7dfa0ab6b1 Mon Sep 17 00:00:00 2001 From: 21pages Date: Sat, 16 Sep 2023 21:46:44 +0800 Subject: [PATCH] remove mac tray session count tooltip, which won't be shown Signed-off-by: 21pages --- src/ipc.rs | 4 ++-- src/tray.rs | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ipc.rs b/src/ipc.rs index 77440d6dd..2a7bf085d 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -233,7 +233,7 @@ pub enum Data { #[cfg(windows)] SyncWinCpuUsage(Option), FileTransferLog(String), - #[cfg(any(windows, target_os = "macos"))] + #[cfg(windows)] ControlledSessionCount(usize), } @@ -483,7 +483,7 @@ async fn handle(data: Data, stream: &mut Connection) { #[cfg(all(feature = "flutter", feature = "plugin_framework"))] #[cfg(not(any(target_os = "android", target_os = "ios")))] Data::Plugin(plugin) => crate::plugin::ipc::handle_plugin(plugin, stream).await, - #[cfg(any(windows, target_os = "macos"))] + #[cfg(windows)] Data::ControlledSessionCount(_) => { allow_err!( stream diff --git a/src/tray.rs b/src/tray.rs index 8dac19bab..fc124e6c4 100644 --- a/src/tray.rs +++ b/src/tray.rs @@ -76,7 +76,7 @@ pub fn make_tray() -> hbb_common::ResultType<()> { let menu_channel = MenuEvent::receiver(); let tray_channel = TrayEvent::receiver(); - #[cfg(not(target_os = "linux"))] + #[cfg(windows)] let (ipc_sender, ipc_receiver) = std::sync::mpsc::channel::(); let mut docker_hiden = false; @@ -108,8 +108,7 @@ pub fn make_tray() -> hbb_common::ResultType<()> { } }; - // ubuntu 22.04 can't see tooltip - #[cfg(not(target_os = "linux"))] + #[cfg(windows)] std::thread::spawn(move || { start_query_session_count(ipc_sender.clone()); }); @@ -146,7 +145,7 @@ pub fn make_tray() -> hbb_common::ResultType<()> { } } - #[cfg(not(target_os = "linux"))] + #[cfg(windows)] if let Ok(data) = ipc_receiver.try_recv() { match data { Data::ControlledSessionCount(count) => { @@ -162,7 +161,7 @@ pub fn make_tray() -> hbb_common::ResultType<()> { }); } -#[cfg(not(target_os = "linux"))] +#[cfg(windows)] #[tokio::main(flavor = "current_thread")] async fn start_query_session_count(sender: std::sync::mpsc::Sender) { let mut last_count = 0;