Skip to content

Commit

Permalink
Fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
james58899 committed May 28, 2024
1 parent 5baa7a3 commit e5f9742
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ fn build_tray_icon() {
};
use tray_icon::{
menu::{Menu, MenuEvent},
ClickType, TrayIconBuilder, TrayIconEvent,
MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent,
};

// Show console
Expand All @@ -470,8 +470,15 @@ fn build_tray_icon() {
event_loop.run(move |_event, _, control_flow| {
*control_flow = ControlFlow::WaitUntil((Instant::now() + Duration::from_millis(100)).into());

if let Ok(event) = tray_channel.try_recv() {
if event.click_type == ClickType::Double {
if let Ok(TrayIconEvent::Click {
id: _,
position: _,
rect: _,
button,
button_state,
}) = tray_channel.try_recv()
{
if button == MouseButton::Left && button_state == MouseButtonState::Up {
console_hide = !console_hide;
switch_window(console_hide)
}
Expand Down

0 comments on commit e5f9742

Please sign in to comment.