espanso/src/keyboard/mod.rs

18 lines
430 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);
}
#[cfg(target_os = "windows")]
2019-08-30 19:24:03 +00:00
pub fn get_backend(sender: mpsc::Sender<char>) -> (impl KeyboardInterceptor, impl KeyboardSender) {
(windows::WindowsKeyboardInterceptor {sender}, windows::WindowsKeyboardSender{})
}