From 4dd868078a0d630e5c85e015079b576da686a2ff Mon Sep 17 00:00:00 2001 From: lashman Date: Fri, 6 Mar 2026 15:24:04 +0200 Subject: [PATCH] Add completion sound, preserve directory structure support - Play system notification sound via canberra-gtk-play when enabled - Implement preserve_directory_structure in output_path_for to maintain relative paths from input directory in output --- pixstrip-core/src/pipeline.rs | 15 ++++++++++++++- pixstrip-gtk/src/app.rs | 11 +++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/pixstrip-core/src/pipeline.rs b/pixstrip-core/src/pipeline.rs index 60b9b8b..89e1bbb 100644 --- a/pixstrip-core/src/pipeline.rs +++ b/pixstrip-core/src/pipeline.rs @@ -89,6 +89,19 @@ impl ProcessingJob { }) .unwrap_or("bin"); - self.output_dir.join(format!("{}.{}", stem, ext)) + let filename = format!("{}.{}", stem, ext); + + if self.preserve_directory_structure { + // Maintain relative path from input_dir + if let Ok(rel) = source.path.strip_prefix(&self.input_dir) { + if let Some(parent) = rel.parent() { + if parent.components().count() > 0 { + return self.output_dir.join(parent).join(filename); + } + } + } + } + + self.output_dir.join(filename) } } diff --git a/pixstrip-gtk/src/app.rs b/pixstrip-gtk/src/app.rs index 3591dd7..bc061bf 100644 --- a/pixstrip-gtk/src/app.rs +++ b/pixstrip-gtk/src/app.rs @@ -1682,6 +1682,17 @@ fn show_results( } } + // Play completion sound (if enabled in settings) + if config.play_completion_sound { + std::thread::spawn(|| { + // Use canberra-gtk-play for system sound (standard on GNOME) + let _ = std::process::Command::new("canberra-gtk-play") + .arg("--id=complete") + .arg("--description=Processing complete") + .output(); + }); + } + // Auto-open output folder if enabled if config.auto_open_output { let output = ui.state.output_dir.borrow().clone();