Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
lucksus committed Nov 18, 2024
1 parent e9ac36a commit 8d3d1b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 4 additions & 5 deletions ui/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ pub fn run() {
open_logs_folder();
});

build_menu(&app.handle())?;
build_system_tray(&app.handle())?;
build_menu(app.handle())?;
build_system_tray(app.handle())?;

let config = rust_executor::Ad4mConfig {
admin_credential: Some(req_credential.to_string()),
Expand Down Expand Up @@ -295,15 +295,14 @@ pub fn run() {

Ok(())
})
.on_window_event(|window, event| match event {
tauri::WindowEvent::CloseRequested { api, .. } => {
.on_window_event(|window, event| {
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
if let Err(e) = window.hide() {
println!("Error trying to hide window: {:?}", e);
} else {
api.prevent_close();
}
}
_ => {}
})
.build(tauri::generate_context!());

Expand Down
10 changes: 6 additions & 4 deletions ui/src-tauri/src/system_tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ pub fn build_system_tray(app: &AppHandle) -> Result<()> {
_ => log::error!("Event is not defined."),
})
.menu_on_left_click(false)
.on_tray_icon_event(|tray, event| match event {
TrayIconEvent::Click {
.on_tray_icon_event(|tray, event| {
if let TrayIconEvent::Click {
button: MouseButton::Left,
button_state: MouseButtonState::Up,
..
} => toggle_main_window(tray.app_handle()),
_ => {}
} = event
{
toggle_main_window(tray.app_handle())
}
})
.build(app)?;

Expand Down

0 comments on commit 8d3d1b2

Please sign in to comment.