Skip to content

Commit

Permalink
add more settings in frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Dec 22, 2024
1 parent 0d67fee commit 772104f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src-tauri/src/commands/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
1 change: 0 additions & 1 deletion src/store/app-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 772104f

Please sign in to comment.