]> git.seodisparate.com - mpd_info_screen/commitdiff
Add flag to disable fill-scaling album art
authorStephen Seo <seo.disparate@gmail.com>
Wed, 15 Dec 2021 10:32:37 +0000 (19:32 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Wed, 15 Dec 2021 10:32:37 +0000 (19:32 +0900)
src/display.rs
src/main.rs

index 413d3b51cd6051138763287878e424a42cbde17d..385ee187a540973455183a9498ad2722de921d41 100644 (file)
@@ -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");
     }
index 70c8b16d2a28c2d01aa167f945e0e6fc54131c04..0b0c1427251c36194b9e4c891995b4907d8e76f8 100644 (file)
@@ -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> {