espanso/src/keyboard/mod.rs

33 lines
697 B
Rust
Raw Normal View History

#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "linux")]
mod linux;
2019-09-05 15:20:52 +00:00
#[cfg(target_os = "macos")]
mod macos;
2019-09-13 13:03:03 +00:00
pub trait KeyboardManager {
2019-09-06 14:06:41 +00:00
fn send_string(&self, s: &str);
fn send_enter(&self);
fn trigger_paste(&self);
2019-09-06 14:06:41 +00:00
fn delete_string(&self, count: i32);
}
2019-09-12 20:14:41 +00:00
// WINDOWS IMPLEMENTATION
#[cfg(target_os = "windows")]
2019-09-13 13:03:03 +00:00
pub fn get_manager() -> impl KeyboardManager {
windows::WindowsKeyboardManager{}
}
2019-09-12 20:14:41 +00:00
// LINUX IMPLEMENTATION
#[cfg(target_os = "linux")]
2019-09-13 13:03:03 +00:00
pub fn get_manager() -> impl KeyboardManager {
linux::LinuxKeyboardManager{}
2019-09-05 15:20:52 +00:00
}
// MAC IMPLEMENTATION
#[cfg(target_os = "macos")]
2019-09-13 13:03:03 +00:00
pub fn get_manager() -> impl KeyboardManager {
macos::MacKeyboardManager{}
}