diff --git a/src-tauri/src/commands/clipboard.rs b/src-tauri/src/commands/clipboard.rs index 66e8d019..8e0c41db 100644 --- a/src-tauri/src/commands/clipboard.rs +++ b/src-tauri/src/commands/clipboard.rs @@ -115,9 +115,19 @@ pub async fn save_clipboard_image(id: i32) -> Result<(), CommandError> { .desktop_dir()? .join(format!("clipboard-{}.{}", id, extension)); - // Save the image to the desktop + // Convert extension to ImageFormat + let format = match extension.to_lowercase().as_str() { + "jpg" | "jpeg" => image::ImageFormat::Jpeg, + "png" => image::ImageFormat::Png, + "gif" => image::ImageFormat::Gif, + "bmp" => image::ImageFormat::Bmp, + "webp" => image::ImageFormat::WebP, + _ => image::ImageFormat::Png, // Default to PNG if unknown format + }; + + // Save the image to the desktop with the correct format let mut file = File::create(image_path)?; - image.write_to(&mut file, image::ImageFormat::Png)?; + image.write_to(&mut file, format)?; Ok(()) } diff --git a/src/store/app-store.ts b/src/store/app-store.ts index a345096c..79ee8eb8 100644 --- a/src/store/app-store.ts +++ b/src/store/app-store.ts @@ -42,7 +42,6 @@ function createAppStore() { const getCurrentTab = () => tabs().find((s) => s.current); const init = async () => { - console.log("AppStore.init"); HotkeyStore.initHotkeys(); ClipboardStore.initClipboards(); await SettingsStore.initSettings();