Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-06-30 13:54:40 +08:00
committed by GitHub
parent 2116fec20b
commit 25d0ced8ba
3 changed files with 18 additions and 10 deletions

View File

@@ -137,14 +137,23 @@ pub fn make_tray() -> hbb_common::ResultType<()> {
if let Ok(_event) = tray_channel.try_recv() {
#[cfg(target_os = "windows")]
if _event.click_type == tray_icon::ClickType::Left
|| _event.click_type == tray_icon::ClickType::Double
{
if last_click.elapsed() < std::time::Duration::from_secs(1) {
return;
match _event {
TrayEvent::Click {
button,
button_state,
..
} => {
if button == tray_icon::MouseButton::Left
&& button_state == tray_icon::MouseButtonState::Up
{
if last_click.elapsed() < std::time::Duration::from_secs(1) {
return;
}
open_func();
last_click = std::time::Instant::now();
}
}
open_func();
last_click = std::time::Instant::now();
_ => {}
}
}