summaryrefslogtreecommitdiff
path: root/pywal
diff options
context:
space:
mode:
authorLorenz Leitner <lorenz.leitner@student.tugraz.at>2019-03-15 09:38:32 +0100
committerLorenz Leitner <lorenz.leitner@student.tugraz.at>2019-03-15 09:38:32 +0100
commitb91ecad12bad39a41611b41f5db436a2cf4f34d7 (patch)
tree76044c386d19f0ac6432126b561d1a9688fc31f8 /pywal
parent8b6ca5cbabc0cd982b72d4aede5639e663b5cdea (diff)
Fix current wallpaper reuse
Diffstat (limited to 'pywal')
-rw-r--r--pywal/image.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/pywal/image.py b/pywal/image.py
index a3ddd8a..ecd46ff 100644
--- a/pywal/image.py
+++ b/pywal/image.py
@@ -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)