[−][src]Function rdev::listen
pub fn listen(callback: Callback) -> Result<(), ListenError>
Listening to global events. Caveat: On MacOS, you require the listen loop needs to be the primary app (no fork before) and need to have accessibility settings enabled.
use rdev::{listen, Event}; fn callback(event: Event) { println!("My callback {:?}", event); match event.name{ Some(string) => println!("User wrote {:?}", string), None => () } } fn main(){ // This will block. if let Err(error) = listen(callback) { println!("Error: {:?}", error) } }