There is an option reported in the docs --cycle-once but this unfortunatley does not work for feh on my Pi.
This code could work. It starts feh in background and uses signal SIGUSR1 to advance to next image. When all images are displayed (the count variable, did not include the file counting and leave this to you), then feh is terminated by SIGINT.
This code could work. It starts feh in background and uses signal SIGUSR1 to advance to next image. When all images are displayed (the count variable, did not include the file counting and leave this to you), then feh is terminated by SIGINT.
Code:
import subprocessimport timeimport psutilimport signalimport os# count your images# set number of images to count variable, here I use just 5count = 5p = subprocess.run("feh . -F -Y &", shell=True)print("feh running")process_name = "feh"pid = Nonefor proc in psutil.process_iter(): if process_name in proc.name(): pid = proc.pid break for _ in range(count): time.sleep(5) os.kill(pid, signal.SIGUSR1)os.kill(pid, signal.SIGINT)
Statistics: Posted by ghp — Sun Jun 09, 2024 1:24 pm