import subprocess
import os
import random
import time

wallpaper_location = "/home/yarne/Pictures/Wallpapers"

unused_wallpapers = os.listdir(wallpaper_location)
used_wallpapers = []

while True:
    random_wallpaper_index = random.randint(0,len(unused_wallpapers))
    random_wallpaper = unused_wallpapers.pop(random_wallpaper_index)
    used_wallpapers.append(random_wallpaper)
    random_wallpaper_location = f'{wallpaper_location}/{random_wallpaper}'

    #matugen image $wallpaper --mode "dark"
    wallpaper_rotate_command = subprocess.call(["matugen","image",random_wallpaper_location,"--mode","dark"])

    time.sleep(300)