mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-05-17 23:00:51 +02:00
General: Better solution to bug.
This commit is contained in:
parent
153a7f92d2
commit
a249f2083b
@ -17,8 +17,8 @@ def random_img(img_dir):
|
|||||||
current_wall = pathlib.Path(CACHE_DIR / "wal")
|
current_wall = pathlib.Path(CACHE_DIR / "wal")
|
||||||
|
|
||||||
if current_wall.is_file():
|
if current_wall.is_file():
|
||||||
wallpaper = util.read_file(current_wall)
|
current_wall = util.read_file(current_wall)
|
||||||
current_wall = os.path.basename(wallpaper[0])
|
current_wall = os.path.basename(current_wall[0])
|
||||||
|
|
||||||
# Add all images to a list excluding the current wallpaper.
|
# Add all images to a list excluding the current wallpaper.
|
||||||
file_types = (".png", ".jpg", ".jpeg", ".jpe", ".gif")
|
file_types = (".png", ".jpg", ".jpeg", ".jpe", ".gif")
|
||||||
@ -27,7 +27,8 @@ def random_img(img_dir):
|
|||||||
|
|
||||||
# If no images are found, use the current wallpaper.
|
# If no images are found, use the current wallpaper.
|
||||||
if not images:
|
if not images:
|
||||||
return pathlib.Path(wallpaper[0])
|
print("image: No new images found (nothing to do), exiting...")
|
||||||
|
quit(1)
|
||||||
|
|
||||||
return pathlib.Path(img_dir / random.choice(images).name)
|
return pathlib.Path(img_dir / random.choice(images).name)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user