diff --git a/src-tauri/src/commands_v2.rs b/src-tauri/src/commands_v2.rs index d6c1f2cae..c3e1e789e 100644 --- a/src-tauri/src/commands_v2.rs +++ b/src-tauri/src/commands_v2.rs @@ -10125,3 +10125,50 @@ pub async fn v2_dynamic_suggest_raw( .await .map_err(|e| format!("Failed to fetch raw dynamic suggestions: {}", e)) } + +// ── Auto-Theme commands ───────────────────────────────────────────────────── + +#[tauri::command] +pub fn v2_detect_desktop_environment() -> crate::auto_theme::system::DesktopEnvironment { + crate::auto_theme::system::detect_desktop_environment() +} + +#[tauri::command] +pub fn v2_get_system_wallpaper() -> Result { + crate::auto_theme::system::get_system_wallpaper() +} + +#[tauri::command] +pub fn v2_get_system_accent_color() -> Result { + crate::auto_theme::system::get_system_accent_color() +} + +#[tauri::command] +#[allow(non_snake_case)] +pub fn v2_generate_theme_from_image( + imagePath: String, +) -> Result { + let palette = crate::auto_theme::palette::extract_palette(&imagePath)?; + Ok(crate::auto_theme::generator::generate_theme( + &palette, + &imagePath, + )) +} + +#[tauri::command] +pub fn v2_generate_theme_from_wallpaper() -> Result { + let wallpaper = crate::auto_theme::system::get_system_wallpaper()?; + let palette = crate::auto_theme::palette::extract_palette(&wallpaper)?; + Ok(crate::auto_theme::generator::generate_theme( + &palette, + &wallpaper, + )) +} + +#[tauri::command] +#[allow(non_snake_case)] +pub fn v2_extract_palette( + imagePath: String, +) -> Result { + crate::auto_theme::palette::extract_palette(&imagePath) +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 5a70b934b..a8d83f92f 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1104,6 +1104,13 @@ pub fn run() { commands_v2::v2_check_qobuzapp_handler, commands_v2::v2_register_qobuzapp_handler, commands_v2::v2_deregister_qobuzapp_handler, + // Auto-theme + commands_v2::v2_detect_desktop_environment, + commands_v2::v2_get_system_wallpaper, + commands_v2::v2_get_system_accent_color, + commands_v2::v2_generate_theme_from_image, + commands_v2::v2_generate_theme_from_wallpaper, + commands_v2::v2_extract_palette, ]) .run(tauri::generate_context!()) .expect("error while running tauri application");