mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-02-10 07:19:31 +01:00
Fix current wallpaper reuse
This commit is contained in:
parent
8b6ca5cbab
commit
b91ecad12b
@ -22,9 +22,10 @@ def get_image_dir_recursive(img_dir):
|
||||
images = []
|
||||
for path, subdirs, files in os.walk(img_dir):
|
||||
for name in files:
|
||||
if name.lower().endswith(file_types):
|
||||
if name.lower().endswith(file_types) and not name.endswith(current_wall):
|
||||
images.append(os.path.join(path, name))
|
||||
|
||||
|
||||
return images, current_wall
|
||||
|
||||
|
||||
@ -58,10 +59,7 @@ def get_random_image_recursive(img_dir):
|
||||
"""Pick a random image file from a directory recursively."""
|
||||
images, current_wall = get_image_dir_recursive(img_dir)
|
||||
|
||||
if len(images) > 2 and current_wall in images:
|
||||
images.remove(current_wall)
|
||||
|
||||
elif not images:
|
||||
if not images:
|
||||
logging.error("No images found in directory.")
|
||||
sys.exit(1)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user