diff --git a/pywal/gen_colors.py b/pywal/gen_colors.py index 773c1a8..f626125 100755 --- a/pywal/gen_colors.py +++ b/pywal/gen_colors.py @@ -22,8 +22,8 @@ def random_img(img_dir): # Add all images to a list excluding the current wallpaper. file_types = (".png", ".jpg", ".jpeg", ".jpe", ".gif") - images = [img for img in os.listdir(img_dir) - if img.endswith(file_types) and img != current_wall] + images = [img for img in os.scandir(img_dir) + if img.name.endswith(file_types) and img.name != current_wall] return pathlib.Path(img_dir / random.choice(images))