2019-08-30 17:45:27 +00:00
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
mod windows;
|
|
|
|
|
2019-09-01 12:58:39 +00:00
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
mod linux;
|
|
|
|
|
2019-09-05 15:20:52 +00:00
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
mod macos;
|
|
|
|
|
2019-09-12 20:14:41 +00:00
|
|
|
pub trait KeyboardSender { // TODO: rename KeyboardManager
|
2019-09-06 14:06:41 +00:00
|
|
|
fn send_string(&self, s: &str);
|
|
|
|
fn send_enter(&self);
|
2019-09-06 22:38:13 +00:00
|
|
|
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
|
2019-08-31 14:07:45 +00:00
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
pub fn get_sender() -> impl KeyboardSender {
|
|
|
|
windows::WindowsKeyboardSender{}
|
2019-09-01 12:58:39 +00:00
|
|
|
}
|
|
|
|
|
2019-09-12 20:14:41 +00:00
|
|
|
// LINUX IMPLEMENTATION
|
2019-09-01 12:58:39 +00:00
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
pub fn get_sender() -> impl KeyboardSender {
|
|
|
|
linux::LinuxKeyboardSender{}
|
2019-09-05 15:20:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// MAC IMPLEMENTATION
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
pub fn get_sender() -> impl KeyboardSender {
|
|
|
|
macos::MacKeyboardSender{}
|
2019-08-30 17:45:27 +00:00
|
|
|
}
|