mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-05-20 17:47:19 +00:00
Fix tray click: handle double-click, show before position, clear stale cache
This commit is contained in:
parent
25f8b40a7b
commit
8b6119639c
1 changed files with 20 additions and 12 deletions
|
|
@ -59,9 +59,7 @@ pub fn run() {
|
|||
init_tray_linux(app.handle().clone(), linux_tray);
|
||||
|
||||
if let Some(window) = app.get_webview_window("popover") {
|
||||
let _ = window.center();
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
let _ = window.hide();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
@ -109,14 +107,23 @@ fn build_tray_tauri(app: &AppHandle) -> tauri::Result<()> {
|
|||
_ => {}
|
||||
})
|
||||
.on_tray_icon_event(|tray, event| {
|
||||
if let TrayIconEvent::Click {
|
||||
button: MouseButton::Left,
|
||||
button_state: MouseButtonState::Up,
|
||||
position,
|
||||
..
|
||||
} = event
|
||||
{
|
||||
toggle_popover(tray.app_handle(), Some((position.x as i32, position.y as i32)));
|
||||
match event {
|
||||
TrayIconEvent::Click {
|
||||
button: MouseButton::Left,
|
||||
button_state: MouseButtonState::Up,
|
||||
position,
|
||||
..
|
||||
} => {
|
||||
toggle_popover(tray.app_handle(), Some((position.x as i32, position.y as i32)));
|
||||
}
|
||||
TrayIconEvent::DoubleClick {
|
||||
button: MouseButton::Left,
|
||||
position,
|
||||
..
|
||||
} => {
|
||||
toggle_popover(tray.app_handle(), Some((position.x as i32, position.y as i32)));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
})
|
||||
.build(app)?;
|
||||
|
|
@ -170,8 +177,9 @@ fn toggle_popover(app: &AppHandle, anchor: Option<(i32, i32)>) {
|
|||
let _ = window.hide();
|
||||
return;
|
||||
}
|
||||
position_popover(&window, anchor);
|
||||
let _ = window.show();
|
||||
let _ = window.unminimize();
|
||||
position_popover(&window, anchor);
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue