diff --git a/Config/Config.qml b/Config/Config.qml index 6122fd5..66fbe6d 100644 --- a/Config/Config.qml +++ b/Config/Config.qml @@ -293,7 +293,6 @@ Singleton { return { enable_pp: screenshot.enable_pp, mode: screenshot.mode, - scale: screenshot.scale, corner_radius: screenshot.corner_radius, drop_shadow: screenshot.drop_shadow, rounded_corners: screenshot.rounded_corners, diff --git a/Config/Screenshot.qml b/Config/Screenshot.qml index 793e1a8..e250ffc 100644 --- a/Config/Screenshot.qml +++ b/Config/Screenshot.qml @@ -6,7 +6,6 @@ JsonObject { property bool enable_pp: true property string mode: "manual" property bool rounded_corners: false - property real scale: 1.0 property int shadow_blur_passes: 1 property real shadow_blur_radius: 22.0 property list shadow_color: [0, 0, 0, 160] diff --git a/zshell-img-tools/src/config.rs b/zshell-img-tools/src/config.rs index f9bcbb3..a60a521 100644 --- a/zshell-img-tools/src/config.rs +++ b/zshell-img-tools/src/config.rs @@ -14,7 +14,6 @@ pub struct EffectsConfig { pub corner_radius: f32, pub drop_shadow: bool, pub rounded_corners: bool, - pub scale: f32, pub shadow_blur_radius: f32, pub shadow_blur_passes: u32, pub shadow_color: [u8; 4], diff --git a/zshell-img-tools/src/main.rs b/zshell-img-tools/src/main.rs index 12c24d9..82da274 100644 --- a/zshell-img-tools/src/main.rs +++ b/zshell-img-tools/src/main.rs @@ -10,7 +10,6 @@ struct CliOverrides { rounded_corners: Option, corner_radius: Option, drop_shadow: Option, - scale: Option, shadow_blur_radius: Option, shadow_blur_passes: Option, shadow_offset_x: Option, @@ -56,6 +55,7 @@ fn main() -> Result<()> { let mut image_path: Option = None; let mut overrides = CliOverrides::default(); + let mut scale: Option = None; let mut i = 0; while i < args.len() { @@ -142,7 +142,7 @@ fn main() -> Result<()> { "--scale" => { i += 1; let val = args.get(i).context("Expected a number after --scale")?; - overrides.scale = Some(val.parse::().context("--scale must be a number")?); + scale = Some(val.parse::().context("--scale must be a number")?); } unknown => bail!("Unknown argument: {unknown}"), } @@ -179,16 +179,14 @@ fn main() -> Result<()> { if let Some(v) = overrides.shadow_color { effects.shadow_color = v; } - if let Some(v) = overrides.scale { - effects.scale = v; - } } - if effects.scale != 1.0 { - effects.corner_radius *= effects.scale; - effects.shadow_blur_radius *= effects.scale; - effects.shadow_offset_x *= effects.scale; - effects.shadow_offset_y *= effects.scale; + // if scale is set do + if let Some(scale) = scale.filter(|&s| s != 1.0) { + effects.corner_radius *= scale; + effects.shadow_blur_radius *= scale; + effects.shadow_offset_x *= scale; + effects.shadow_offset_y *= scale; } if let Err(e) = process_image(&image_path, &effects) { @@ -226,23 +224,5 @@ fn process_image(path: &str, effects: &config::EffectsConfig) -> Result<()> { .context("Failed to write image data to swappy")?; } - // Writes the PNG bytes to swappy's stdin and waits for swappy to close - // child - // .stdin - // .take() - // .context("Failed to get swappy stdin")? - // .write_all(&png_bytes) - // .context("Failed to write image data to swappy")? - // .spawn(); - // - // let status = child.await().context("Failed to wait for swappy")?; - // - // if !status.success() { - // eprintln!( - // "swappy exited with non-zero status for '{}': {}", - // path, status - // ); - // } - Ok(()) }