espanso/src/ui/mod.rs

32 lines
629 B
Rust
Raw Normal View History

2019-09-06 14:06:41 +00:00
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "macos")]
mod macos;
pub trait UIManager {
fn notify(&self, message: &str);
}
// MAC IMPLEMENTATION
#[cfg(target_os = "macos")]
2019-09-06 20:30:20 +00:00
pub fn get_uimanager() -> impl UIManager {
2019-09-09 13:15:01 +00:00
macos::MacUIManager::new()
2019-09-06 20:30:20 +00:00
}
// LINUX IMPLEMENTATION
#[cfg(target_os = "linux")]
pub fn get_uimanager() -> impl UIManager {
let manager = linux::LinuxUIManager{};
manager.initialize();
manager
}
// WINDOWS IMPLEMENTATION
#[cfg(target_os = "windows")]
pub fn get_uimanager() -> impl UIManager {
2019-09-07 22:51:08 +00:00
windows::WindowsUIManager::new()
2019-09-06 14:06:41 +00:00
}