Release!
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user