`In a tauri app(MacOS primarily) want to listen global keypress and mouse events.
I tried using rdev(https://github.com/Narsil/rdev.git) and here’s the code but it doesn’t seem to work. Nothing is printed in terminal.
Code is like:
use rdev::{listen, Event}; use std::thread; use tauri::Manager;
fn callback(event: Event) { println!("My callback {:?}", event); } fn main() { thread::spawn(|| listen(callback));
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![
])
.setup(|app| {
let window = app.get_window("main").unwrap();
window.open_devtools();
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running Tauri application");
}
2