import os import subprocess import schedule import time def set_screensaver(): # Step 1: Run Dale_generator.py try: result = subprocess.run(["python3", "/path/to/Dale_generator.py"]) # Step 2: Identify the path of the generated image desktop_path = os.path.expanduser("~/Desktop") image_path = os.path.join(desktop_path, "generated_image.jpg") # Check if the image exists if not os.path.exists(image_path): print("Image not found on the desktop!") return # Step 3: Set the identified image as a screensaver subprocess.run(["feh", "--bg-scale", image_path]) print("Screensaver set successfully!") except Exception as e: print("Error:", e) # Schedule the set_screensaver function to run every hour schedule.every().hour.do(set_screensaver) # Keep the script running to allow the scheduled task to execute while True: schedule.run_pending() time.sleep(1)