This commit is contained in:
2026-06-11 10:43:30 -04:00
parent 336e6a264c
commit 4f92942ccb
9 changed files with 175 additions and 24 deletions
+17
View File
@@ -66,6 +66,7 @@ pub fn run() {
Ok(())
})
.invoke_handler(tauri::generate_handler![alert_detected])
.on_window_event(|window: &tauri::Window, event: &WindowEvent| {
if let WindowEvent::CloseRequested { api, .. } = event {
api.prevent_close();
@@ -75,3 +76,19 @@ pub fn run() {
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
#[tauri::command]
fn alert_detected(app: tauri::AppHandle, name: String) {
if let Some(window) = app.get_webview_window("main") {
let _ = window.unminimize();
let _ = window.show();
let _ = window.set_focus();
let _ = window.set_always_on_top(true);
let win = window.clone();
std::thread::spawn(move || {
std::thread::sleep(std::time::Duration::from_secs(5));
let _ = win.set_always_on_top(false);
});
}
println!("[DuressGuard] Alert: {}", name);
}