From 570b6ab33ca4ba245642b9b54a08e09978172173 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Wed, 15 Dec 2021 19:32:37 +0900 Subject: [PATCH] Add flag to disable fill-scaling album art --- src/display.rs | 7 +++++-- src/main.rs | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/display.rs b/src/display.rs index 413d3b5..385ee18 100644 --- a/src/display.rs +++ b/src/display.rs @@ -455,7 +455,10 @@ impl EventHandler for MPDDisplay { self.album_art = None; self.album_art_draw_transform = None; } else { - self.get_album_art_transform(ctx, true); + self.get_album_art_transform( + ctx, + !self.opts.do_not_fill_scale_album_art, + ); } } else { self.album_art = None; @@ -576,7 +579,7 @@ impl EventHandler for MPDDisplay { } fn resize_event(&mut self, ctx: &mut Context, _width: f32, _height: f32) { - self.get_album_art_transform(ctx, true); + self.get_album_art_transform(ctx, !self.opts.do_not_fill_scale_album_art); self.refresh_text_transforms(ctx) .expect("Failed to set text transforms"); } diff --git a/src/main.rs b/src/main.rs index 70c8b16..0b0c142 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,6 +30,11 @@ pub struct Opt { disable_show_filename: bool, #[structopt(long = "pprompt", help = "input password via prompt")] enable_prompt_password: bool, + #[structopt( + long = "no-scale-fill", + help = "don't scale-fill the album art to the window" + )] + do_not_fill_scale_album_art: bool, } fn main() -> Result<(), String> {