use anyhow::Result;
use async_trait::async_trait;
use std::path::{Path, PathBuf};
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct DownloadRequest {
pub category: Option<String>,
pub resolution: Option<(u32, u32)>,
pub quality: Option<String>,
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct WallpaperOptions {
pub transition: Option<String>,
pub duration: Option<u32>,
pub fps: Option<u32>,
pub scaling: WallpaperScaling,
pub monitor: MonitorSelection,
pub fire_and_forget: bool,
}
#[derive(Debug, Clone, Default)]
#[allow(dead_code)]
pub enum WallpaperScaling {
#[default]
Fill, Fit, Stretch, Center, Tile, }
#[derive(Debug, Clone, Default)]
#[allow(dead_code)]
pub enum MonitorSelection {
Primary, #[default]
All, Specific(u32), }
#[async_trait]
#[allow(dead_code)]
pub trait WallpaperBackend {
async fn set_wallpaper(&self, image_path: &Path, options: &WallpaperOptions) -> Result<()>;
async fn get_current_wallpaper(&self) -> Result<Option<PathBuf>>;
fn is_available(&self) -> bool;
fn priority(&self) -> u32;
fn name(&self) -> &'static str;
fn supported_transitions(&self) -> Vec<String>;
fn validate(&self) -> Result<()> {
if !self.is_available() {
return Err(anyhow::anyhow!("Backend '{}' is not available", self.name()));
}
Ok(())
}
}
impl Default for WallpaperOptions {
fn default() -> Self {
Self {
transition: None,
duration: None,
fps: None,
scaling: WallpaperScaling::Fill,
monitor: MonitorSelection::All,
fire_and_forget: false,
}
}
}