Hi, I have a tray app that should open and close when the tray icon is clicked AND when focus is lost (clicking outside of the window)
the only issue is that my window handler will try to hide the window, while the tray handler will show it again because it just got hidden:
.on_system_tray_event(|app, event| match event {
SystemTrayEvent::LeftClick { position, .. } => {
if let Some(window) = app.get_window("main") {
if window.is_visible().unwrap() {
window.hide().unwrap();
} else {
window.show().unwrap();
window.set_focus().unwrap();
};
}
}
// ...
})
.on_window_event(|event| match event.event() {
WindowEvent::Focused(focused) => {
if !focused {
event.window().hide().unwrap();
}
}
_ => (),
})
any idea as to how i could make them not interfere with each other?