At a family event just shy of a year ago I wanted to set up a slideshow (two in fact) to run continuously. The event was outdoors and leaving two laptops exposed to the elements for an extended period of time was obviously not very appealing. Instead a couple of Raspberry Pis together with the feh image viewer proved to be the perfect fit.
- Pi: Raspberry Pi 3
- OS: Raspbian 9 (Stretch)
- Desktop: LXDE
Feh Installation and Test
First install feh:
apt-get install feh
Then run the following command in the terminal:
feh \ --recursive \ --randomize \ --fullscreen \ --quiet \ --hide-pointer \ --slideshow-delay 6 \ yourPicDir
The command line switches are for the most part self-explanatory. The idea is to give feh a directory containing pictures you’ve copied to the Pi and then have it cycle through them randomly, displaying each for six seconds. Other options are documented in the man pages if you’d like to customize the usage.
To exit the slideshow press the Esc key.
Disabling Screen Blanking
By default the screen will blank after a few minutes of mouse and keyboard inactivity. In order to disable the screen blanking we’ll need to modify the lightdm.conf file:
and add the following line under the [Seat:*] section:
xserver-command=X -s 0 dpms
Auto-Start Slideshow On Boot
To have the slideshow automatically start on boot, first create a small shell script file to hold the feh command:
and paste the following:
#!/bin/bash feh \ --recursive \ --randomize \ --fullscreen \ --quiet \ --hide-pointer \ --slideshow-delay 6 \ yourPicDir
Be sure to make the new shell script executable:
chmod 755 /home/pi/slideshow.sh
And finally add it to the pi user’s LXDE autostart file:
echo "@/home/pi/slideshow.sh" >> /home/pi/.config/lxsession/LXDE-pi/autostart
When you reboot your Raspberry Pi it should now automatically start the slideshow.
To exit the slideshow, hit the Esc key and you will see the normal LXDE desktop.