diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/user_interface.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/user_interface.py b/src/user_interface.py index 99eb524..f3d068a 100644 --- a/src/user_interface.py +++ b/src/user_interface.py @@ -38,8 +38,16 @@ def colorPickerUI(img_path: str) -> tuple: def pickRandomWallpaper() -> str: confirmed = False + history = [] + num_wallpapers = len(os.listdir(Paths['wallpapers'])) while not confirmed: + if len(history) == num_wallpapers: + print('[bold blue] Wallpapers exhausted. Resetting history...') + history.clear() wallpaper = Paths['wallpapers'] + random.choice(os.listdir(Paths['wallpapers'])) + if wallpaper in history: + continue + history.append(wallpaper) # TODO: Replace image preview with something native to python # (Currently borrowing viu module from Rust) os.system(f'viu {wallpaper}') |
