use async_trait::async_trait;
use crate::backend::DesktopBackend;
use crate::errors::{CarDesktopError, Result};
use crate::models::{
ClickRequest, DisplayId, Frame, KeyPressRequest, PermissionRequest, PermissionSnapshot,
TypeRequest, UiMap, WindowFilter, WindowHandle, WindowInfo,
};
const PLATFORM: &str = "linux";
fn unsupported<T>() -> Result<T> {
Err(CarDesktopError::PlatformUnsupported { platform: PLATFORM })
}
pub struct LinuxBackend;
impl LinuxBackend {
pub fn new() -> Self {
Self
}
}
impl Default for LinuxBackend {
fn default() -> Self {
Self::new()
}
}
#[async_trait]
impl DesktopBackend for LinuxBackend {
async fn list_windows(&self, _filter: WindowFilter) -> Result<Vec<WindowInfo>> {
unsupported()
}
async fn observe_window(&self, _window: WindowHandle) -> Result<UiMap> {
unsupported()
}
async fn capture_display(&self, _display: DisplayId) -> Result<Frame> {
unsupported()
}
async fn focus_window(&self, _window: WindowHandle) -> Result<()> {
unsupported()
}
async fn click(&self, _request: ClickRequest) -> Result<()> {
unsupported()
}
async fn type_text(&self, _request: TypeRequest) -> Result<()> {
unsupported()
}
async fn keypress(&self, _request: KeyPressRequest) -> Result<()> {
unsupported()
}
async fn permissions(&self) -> Result<PermissionSnapshot> {
unsupported()
}
async fn request_permissions(&self, _needs: PermissionRequest) -> Result<PermissionSnapshot> {
unsupported()
}
}