espanso/src/keyboard/mod.rs

24 lines
531 B
Rust
Raw Normal View History

#[cfg(target_os = "windows")]
mod windows;
use std::sync::mpsc;
2019-08-30 19:24:03 +00:00
pub trait KeyboardInterceptor {
fn initialize(&self);
fn start(&self);
}
2019-08-30 19:24:03 +00:00
pub trait KeyboardSender {
fn send_string(&self, s: &str);
fn delete_string(&self, count: i32);
2019-08-30 19:24:03 +00:00
}
#[cfg(target_os = "windows")]
pub fn get_interceptor(sender: mpsc::Sender<char>) -> impl KeyboardInterceptor {
windows::WindowsKeyboardInterceptor {sender}
}
#[cfg(target_os = "windows")]
pub fn get_sender() -> impl KeyboardSender {
windows::WindowsKeyboardSender{}
}